Examples

Playback From Stream(1)

livePlaybackWithoutBackPressure

livePlaybackWithoutBackPressure

A very simple example showing how to play Live Data without back pressure. It feeds a live stream, without waiting that the Futures are completed for each block. This is simpler than playing buffers synchronously because the App does not need to await that the playback for each block is completed playing another one.

This example get the data from an asset file, which is completely stupid : if an App wants to play a long asset file he must use startPlayer().

Feeding Flutter Sound without back pressure is very simple but you can have two problems :

  • If your App is too fast feeding the audio channel, it can have problems with the Stream memory used.

  • The App does not have any knowledge of when the provided block is really played.

    For example, if it does a "stopPlayer()" it will loose all the buffered data.

This example uses the FoodEvent object to resynchronize the output stream before doing a stopPlayer()

The complete example source is there

Last updated