SoundPlayerUI
Last updated
Last updated
The SoundPlayerUI provides a Playback widget styled after the HTML 5 audio player.
The player displays a loading indicator and allows the user to pause/resume/skip via the progress bar.
You can also pause/resume the player via an api call to SoundPlayerUI's state using a GlobalKey.
The SoundPlayerUI widget allows you to playback audio from multiple sources:
File
Asset
URL
Buffer
When using the SoundPlayerUI
you MUST pass a Track
that has been initialised with a supported MediaFormat
.
The Widget needs to obtain the duration of the audio that it is play and that can only be done if we know the MediaFormat
of the Widget.
If you pass a Track
that wasn't constructed with a MediaFormat
then a MediaFormatException
will be thrown.
The MediaFormat
must also be natively supported by the OS. See MediaFormat for additional details on checking for a supported format.
Sounds
uses Track as the primary method of handing around audio data.
You can also dynamically load a Track
when the user clicks the 'Play' button on the SoundPlayerUI
widget. This allows you to delay the decision on what Track is going to be played until the user clicks the 'Play' button.