AudioFile
Methods
initWithLocalFile
Initializes an AudioFile instance to play local audio file.On android, the audio file should be located in resources "raw" folder.
Parameters
name:
string
Local audio file name
type:
string
Local audio file type/format, for example ".mp3"
usage:
Audio file usage mode. ANDROID ONLY.
Returns
type:
Promise<void>
loadFile
Initializes an AudioFile to play a stream from a network.
Parameters
url:
string
HTTP URL of the stream to play
usage:
Audio file usage mode. ANDROID ONLY.
Returns
type:
Promise<void>
off
Removes a handler for the specified AudioFile event.
Parameters
eventType:
event:
Function
OptionalHandler function. If not specified, all handlers for the event are removed.
Returns
type:
void
on
Registers a handler for the specified AudioFile event. One event can have more than one handler. Use the [AudioFile#off] method to delete a handler.
Parameters
eventType:
event:
Function
Returns
type:
void
play
Starts playing the audio file repeatedly or once.
Parameters
looped:
boolean
Whether the audio file should be played repeatedly or once
Returns
type:
Promise<AudioFileEventTypes.Started>
releaseResources
Releases all resources allocated to play the audio file.Should be called even if the audio file has not been played.
Returns
type:
void
Props
looped
Whether the audio file should be played repeatedly or once.
name
Local audio file name.
url
HTTP URL of the stream to play.