[HELP]: Web: Record to Stream
Is there support for recording to a stream on web? I'm playing around with code as per below (just shots in the dark).
On web, it's not hitting the listen method, i.e not printing Adding to sink WEB. I've also played around with only calling toStream, but then I get a mismatch with initialiizing recordingDataController as StreamController<Uint8List>().
The record method is working fine on a native Android device.
Future<void> record() async {
var webRecordingDataController = StreamController<List<Float32List>>();
var recordingDataController = StreamController<Uint8List>();
_mRecordingDataSubscription = recordingDataController.stream.listen((buffer) {
print('Adding to sink--------- ');
voiceChannel!.sink.add(buffer);
});
_mRecordingDataSubscription = webRecordingDataController.stream.listen((buffer) {
print('Adding to sink WEB!!!!!!!!!!!!!!!!!---------');
voiceChannel!.sink.add(buffer);
});
await mRecorder!.startRecorder(
toStream: kIsWeb ? null : recordingDataController.sink,
toStreamFloat32: kIsWeb ? webRecordingDataController.sink : null,
codec: kIsWeb ? Codec.opusWebM : Codec.pcm16,
numChannels: 1,
sampleRate: 24000,
bufferSize: 8192,
);
}
Anyone gotten recording to stream on web to work?
Flutter Sound 9.21.1 is released. It implements Float 32 not interleaved stream on Web. I will work on Int16 and interleaved format on web later. See this guide and this example
9.21.1
-
playFromMic()is deprecated -
feedFromStream()is deprecated -
foodSinkgetter is deprecated -
startPlayerFromStream()with back pressure is deprecated -
startPlayerFromStream(): no morewhenFinishedparameter -
add functions
feedUint8FromStream(),feedInt16FromStream()andfeedF32FromStream() -
add getters
uint8ListSink,float32Sinkandint16Sink -
On web :
startPlayerFromStream()is implemented for codec.pcmFloat32 and not interleaved -
TODO
- On Web : Implement Streams Int16
- On Web : Implement Stream interleaved.