switchAudio method

Future<void> switchAudio(
  1. bool isEnable
)

switch Audio

This switch Audio

Throws a CameraException if the capture fails.

Implementation

Future<void> switchAudio(bool isEnable) async {
  if (!value.isInitialized! || _isDisposed) {
    throw CameraException(
      'Uninitialized CameraController',
      'startVideoStreaming was called on uninitialized CameraController',
    );
  }
  if (!value.isStreamingVideoRtmp!) {
    throw CameraException(
      'No video is recording',
      'resumeVideoStreaming was called when no video is streaming.',
    );
  }
  if (!Platform.isAndroid) {
    throw CameraException(
      'Currently only supports Android platform',
      'Please use on Android platform',
    );
  }
  try {
    await _channel.invokeMethod<void>(
        'switchAudio', <String, dynamic>{'isEnable': isEnable});
  } on PlatformException catch (e) {
    throw CameraException(e.code, e.message);
  }
}