Rate this page:

VIAudioFile

Class may be used to play audio files.

Constructors

VIAudioFile.network

Copy URL

Constructs a VIAudioFile to play an audio file obtained from the network.

Parameters

  • url:

    String

    HTTP URL of the stream to play

  • Optional

    Audio file usage mode. ANDROID ONLY.

Methods

initialize

Copy URL

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

Copy URL

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

Copy URL

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

Copy URL

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

Copy URL

bool

looped

Indicate if the audio file should be played repeatedly or once

Returns

  • type:

    bool

name

Copy URL

String

name

Local audio file name

Returns

  • type:

    String

onStopped

Copy URL

VIAudioFileStopped

onStopped

Invoked when the audio file playing is stopped.

Returns

url

Copy URL

String

url

HTTP URL of the stream to play

Returns

  • type:

    String