startRecorder method
Sets subscription duration, starts recorder from the platform channel, then sets up recorder stream
Implementation
Future<String> startRecorder() async {
try {
await _channel.invokeMethod("setSubscriptionDuration",
<String, double>{'sec': this.getSubscriptionDuration});
} catch (err) {
print("Could not set subscription duration, error: $err");
}
if (this.getIsRecording) {
throw new RecorderRunningException("Recorder is already running.");
}
try {
String result =
await _channel.invokeMethod('startRecorder', <String, dynamic>{
'tuning': this.getTuning,
'numChannels': this.getNumChannels,
'sampleRate': this.getSampleRate,
'androidAudioSource': this.getAndroidAudioSource.value,
'tolerance': this.getTolerance,
});
_setRecorderCallback();
this.setIsRecording = true;
return result;
} catch (err) {
throw new Exception(err);
}
}