feedUint8FromStream
feedUint8FromStream method
- 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
- feedInt16FromStream()
- feedF32FromStream()
- float32Sink
- int16Sink
- uint8ListSink
- Please look to this small guide if you need help
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);
}