attach method

  1. @override
Future<void> attach(
  1. covariant CameraController controller
)

Called when an output should be attached to a CameraController.

This should not need to be called by a user directly unless implementing their own CameraOutput.

Implementation

@override
Future<void> attach(covariant CameraController controller) {
  super.attach(controller);
  _controller = controller;
  mediaRecorder = MediaRecorder();
  mediaRecorder.setCamera(controller.camera);
  mediaRecorder.setVideoSource(VideoSource.camera);
  if (includeAudio) mediaRecorder.setAudioSource(AudioSource.defaultSource);
  mediaRecorder.setOutputFormat(OutputFormat.mpeg4);
  if (includeAudio) mediaRecorder.setAudioEncoder(AudioEncoder.amrNb);
  return mediaRecorder.setVideoEncoder(VideoEncoder.mpeg4Sp);
}