startRecording method
Starts the recording session.
Initiates the recorder and transitions status to RecorderStatus.starting and then to RecorderStatus.recording on success.
Always await the returned future to ensure the operation has completed.
Returns
- GemError.success The recorder started and is in RecorderStatus.recording.
- GemError.busy The recorder is busy and could not start.
- GemError.invalidInput The provided configuration is invalid (for example none of the requested RecorderConfiguration.recordedTypes are available).
- GemError.noDiskSpace Not enough disk space to start recording.
- GemError.overheated Device temperature prevents starting the recorder.
- GemError.general A generic error occurred.
Implementation
Future<GemError> startRecording() async {
final String? resultString = await GemKitPlatform.instance
.getChannel(mapId: -1)
.invokeMethod<String>(
'callObjectMethod',
jsonEncode(<String, Object>{
'id': pointerId,
'class': 'Recorder',
'method': 'startRecording',
'args': <dynamic, dynamic>{},
}),
);
return GemErrorExtension.fromCode(jsonDecode(resultString!)['result']);
}