The easiest way to start with Sounds is to use one of the built in Widgets.
If you don’t like any of the provided Widgets you can build your own from scratch.
The Sounds widgets are all built using the public Sounds API and also provide working examples when building your own widget.
The SoundPlayerUI widget 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 api documentation provides examples on using the SoundPlayerUI widget.
The SoundRecorderUI widget provide a simple UI for recording audio.
The audio is recorded to a Track.
TODO: add image here.
The SoundRecorderUI api documentation provides examples on using the SoundRecorderUI widget.
The RecorderPlaybackController is a specialised Widget which is used to co-ordinate a paired SoundPlayerUI and a SoundRecorderUI widgets.
Often when providing an interface to record audio you will want to allow the user to playback the audio after recording it. However you don’t want the user to try and start the playback before the recording is complete.
The RecorderPlaybackController widget does not have a UI (its actually an InheritedWidget) but rather is used to as a bridge to allow the paired SoundPlayerUI and SoundRecorderUI to communicate with each other.
The RecorderPlaybackController co-ordinates the UI state between the two components so that playback and recording cannot happen at the same time.
See the API documenation on RecorderPlaybackController for examples of how to use it.