Skip to main content Link Menu Expand (external link) Document Search Copy Copied
feedUint8FromStream method - FlutterSoundPlayer class - player library - Dart API
menu
feedUint8FromStream

feedUint8FromStream method

Future<int> feedUint8FromStream(
  1. Uint8List buffer
)

Feed a UInt8 stream interleaved when a flow control is wanted


Please look to this small guide if you need help.

Parameters

  • buffer: is a Uint8List containing the audio data that you want to play.

Return

Returns a Future that you MUST await if you really need a flow control. This future is declared completed when the data has been played, or at least when they had be given to the lower layer of the software. Note: don't use the int returned. It is just for legacy reason and must not be used.

Example

await myPlayer.startPlayerFromStream
(
    codec: Codec.pcm16
    numChannels: 2
    sampleRate: 48100
    interleaved: true,
);

await myPlayer.feedUint8FromStream(myData);

See also


Implementation

Future<int> feedUint8FromStream(Uint8List buffer) async {
  await _waitOpen();
  if (_isInited != Initialized.fullyInitialized) {
    throw Exception('Player is not open');
  }
  if (isStopped) {
    return 0;
  }
  return _feed(buffer);
}
flutter_sound 9.25.3