VIAudioFile
Class may be used to play audio files.
Constructors
VIAudioFile.file
Constructs a VIAudioFile to play an audio from a file.
Parameters
name:
String?
Local audio file name
type:
String?
Local audio file type/format, for example ".mp3"
usage:
OptionalAudio file usage mode. ANDROID ONLY.
On android, the audio file must be located in resources "raw" folder.
VIAudioFile.network
Constructs a VIAudioFile to play an audio file obtained from the network.
Parameters
url:
String?
HTTP URL of the stream to play
usage:
OptionalAudio file usage mode. ANDROID ONLY.
Methods
initialize
Future<void>
initialize()
Initialize and prepare the audio file to play
Must be used before any other interactions with the object
Returns
type:
Future<void>
play
Future<void>
play(bool
looped)
Starts playing the audio file
Throws VIException, if an error occurred. For all possible errors see VIAudioFileError
Parameters
looped:
bool
Indicate if the audio file should be played repeatedly or once
Returns
type:
Future<void>
releaseResources
Future<void>
releaseResources()
Releases all resources allocated for playing audio file.
Must be called even if the file was not played.
Throws VIException, if an error occurred.
Returns
type:
Future<void>
stop
Future<void>
stop()
Stops playing of the audio file
Throws VIException, if an error occurred. For all possible errors see VIAudioFileError
Returns
type:
Future<void>
Props
looped
bool
looped
Indicate if the audio file should be played repeatedly or once
Returns
type:
bool
name
String?
name
Local audio file name
Returns
type:
String?
onStopped
onStopped
Invoked when the audio file playing is stopped.
Returns
type:
type
String?
type
Local audio file type/format, for example ".mp3"
Returns
type:
String?
url
String?
url
HTTP URL of the stream to play
Returns
type:
String?