getStreamStatistics method
Get statistics about the rtmp stream.
Throws a CameraException if image streaming was not started.
Implementation
Future<StreamStatistics> getStreamStatistics() async {
if (!value.isInitialized! || _isDisposed) {
throw CameraException(
'Uninitialized CameraController',
'stopImageStream was called on uninitialized CameraController.',
);
}
if (!value.isStreamingVideoRtmp) {
throw CameraException(
'No camera is streaming images',
'stopImageStream was called when no camera is streaming images.',
);
}
try {
var data = await _channel
.invokeMapMethod<String, dynamic>('getStreamStatistics');
return StreamStatistics(
sentAudioFrames: data?["sentAudioFrames"],
sentVideoFrames: data?["sentVideoFrames"],
height: data?["height"],
width: data?["width"],
bitrate: data?["bitrate"],
isAudioMuted: data?["isAudioMuted"],
cacheSize: data?["cacheSize"],
droppedAudioFrames: data?["drpppedAudioFrames"],
droppedVideoFrames: data?["droppedVideoFrames"],
);
} on PlatformException catch (e) {
throw CameraException(e.code, e.message!);
}
}