startStream method
Same as start with output stream instead of a path.
When stopping the record, you must rely on stream close event to get full recorded data.
Implementation
Future<Stream<Uint8List>> startStream(RecordConfig config) async {
final stream = await _safeCall(
() async {
await _stopRecordStream();
return _platform.startStream(_recorderId, config);
},
);
_recordStreamCtrl = StreamController.broadcast();
_recordStreamSubscription = stream.listen(
(data) {
final streamCtrl = _recordStreamCtrl;
if (streamCtrl == null || streamCtrl.isClosed) return;
streamCtrl.add(data);
},
);
_startAmplitudeTimer();
return _recordStreamCtrl!.stream;
}