NgAudioObject can be used to control a sound file. It can be attached to the
$scope.
| constructor(pathOrId:String) |
Returns an audio object which automatically loads an object,
- which is found at the path specified
- or on the DOM in an audio element with an ID the same as specified
|
| play() |
Plays the sound. |
| pause() |
Pauses the sound. |
| stop() |
Restarts the sound.
alias restart
|
| unbind() |
Removes all the listeners from the audio object, improving performance, but disabling most read functionality.
For example, setting progress and currentTime will still work, but reading them will not return the correct value.
|
| currentTime:number |
Read - reads the current time of the sound in seconds.
Write - sets the current time of the sound.
|
| volume:number |
Read - reads the volume of the sound from 0 - 1.
Write - sets the volume of the sound.
|
| progress:number |
Read - returns the playthrough progress of the sound from 0 - 1.
Write - sets the current time of the of the sound as a percentage from 0 to 1.
|
| playbackRate:number |
Read - returns the speed that the sound is playing at, typically from 0.5 - 1.5.
Write - sets the audio speed. Values between 0.5 and 1.5 are recommended.
|
| muting:boolean |
Read - whether or not the sound is muting.
Write - set a boolean to mute or unmute the sound.
When a sound is muting, its will make no noise, but it can be played, be paused, and have its volume adjusted.
|
| loop:number or true |
Read - the number of times the audio will play again after it's done playing, or true if it will repeat indefinitely
Write - setting a number will cause the audio to play that many more times after finishing. Setting the value to true will cause the sound to loop indefinitely.
|
| remaining:number (read only) |
Time remaining in seconds.
|
| audio: NativeHTMLAudio (read only) |
Reference to the native audio file used by the object.
|
| canPlay:boolean (read only) |
Is true if the sound is loaded enough to play.
This is not well supported in all browsers.
|
| error:boolean (read only) |
Is true if the sound could not be loaded.
|
| destroyed:boolean (read only) |
Is true if the NgAudioObject has been destroyed.
|