Creates an event emitter instance to listen for the actions
Call the function to remove the event
Gets as any arguments as it needs
Creates an event emitter instance to listen for the actions
Call the function to remove the event
Creates an event emitter instance to listen for the actions
Call the function to remove the event
Gets as any arguments as it needs
Creates an event emitter instance to listen for the actions
Call the function to remove the event
Removes the specified event and invokes the callback after it is removed
Optional
callback: EventListenerCallbackAdds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.
Adds a one-time listener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.
Readonly
isChecks whether the sound is playing.
0.1
Readonly
isGets/sets whether the sound is looping or non-looping.
0.1
Gets/sets the volume of the sound. The range is between {0.0, 1.0}
0.1
Readonly
totalGets the duration in milliseconds.
0.1
Readonly
currentGets the current duration in milliseconds.
0.1
Picks a sound on the device.
import Sound from '@smartface/native/device/sound';
Sound.android.pick({onSuccess: soundPicked});
function soundPicked(e) {
if(!e.sound.isPlaying)
e.sound.play();
}
pick
1.1.8
Object describing function parameters.
(required since 1.1.8)
Callback for success situation.
Callback for failure situation.
Triggered when the sound is ready for playing.
0.1
onReady
import Sound from '@smartface/native/device/sound';
const sound1 = new Sound();
sound.on(Sound.Events.Ready, (params) => {
console.info('onReady', params);
});
Triggered when the sound complited playing.
onFinish
0.1
import Sound from '@smartface/native/device/sound';
const sound1 = new Sound();
sound1.on(Sound.Events.Finish, (params) => {
console.info('onFinish', params);
});
Generated using TypeDoc
Since
0.1
Android
Ios
Controls sound files.
Example