0.1.0 • Published 6 years ago
@therudnick/audio-ng v0.1.0
AudioNg
This project was generated with Angular CLI version 1.5.0. Built and published following the methods in the Angular Library Starter project.
AudioNgModule
Exports AudioNgComponent
with the following API:
<audio-ng [src]="url" [controls]="true/false" [preload]="'auto'" (register)="someFunction($event)"></audio-ng>
[src]
specifies the fully qualified URL of the audio file to be loaded[controls]
specifies whether or not to show the generic HTML5 audio controls[preload]
defines the loading behavior, defaults to 'auto'(register)
emits an event passing the component itself as the argument
The AudioNgComponent
currently supports the following functionality:
- play(start?: number, duration?: number): begins playback at current position or
start
and plays for the entire duration of the file or forduration
ms (e.g.audioNgComponent.play(2, 1000) // begin playback at 2 seconds and stop playback after 1000 ms
) - loop(start: number, duration: number): begins playback at
start
and loops everyduration
ms (e.g.audioNgComponent.loop(2, 1000) // begin playback at 2 seconds, stop playing after 1000 ms, and repeat
) - pause(): pauses playback or looping
- unpause(): unpauses playback or looping
- stop(): stop playback or looping and set currentTime to 0
Example usage
COMING SOON