private void configureCaptureSession() {
    try {
      AVAudioSession.getSharedInstance().setCategory(AVAudioSessionCategory.Record);
      AVAudioSession.getSharedInstance().setActive(true);

      captureSession = new AVCaptureSession();

      AVCaptureDevice videoDevice = AVCaptureDevice.getDefaultDeviceForMediaType(AVMediaType.Video);
      AVCaptureDevice audioDevice = AVCaptureDevice.getDefaultDeviceForMediaType(AVMediaType.Audio);

      videoInput = AVCaptureDeviceInput.create(videoDevice);
      audioInput = AVCaptureDeviceInput.create(audioDevice);

      stillImageOutput = new AVCaptureStillImageOutput();
      AVVideoSettings outputSettings = new AVVideoSettings();
      outputSettings.set(AVVideoSettings.Keys.Codec(), new NSString("jpeg"));
      stillImageOutput.setVideoOutputSettings(outputSettings);

      movieFileOutput = new AVCaptureMovieFileOutput();

      captureSession.beginConfiguration();
      captureSession.addInput(videoInput);
      captureSession.addInput(audioInput);
      captureSession.addOutput(movieFileOutput);
      captureSession.addOutput(stillImageOutput);
      captureSession.commitConfiguration();

      captureSession.startRunning();
    } catch (NSErrorException e) {
      e.printStackTrace();
    }
  }
Exemple #2
0
 @MarshalsPointer
 public static long toNative(List<AVVideoSettings> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSDictionary<NSString, NSObject>> array = new NSMutableArray<>();
   for (AVVideoSettings i : l) {
     array.add(i.getDictionary());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
Exemple #3
0
 /** @since Available in iOS 6.0 and later. */
 public AVAssetWriterInput(
     AVMediaType mediaType, AVVideoSettings outputSettings, CMFormatDescription sourceFormatHint) {
   super((SkipInit) null);
   initObject(init(mediaType, outputSettings.getDictionary(), sourceFormatHint));
 }
Exemple #4
0
 public AVAssetWriterInput(AVMediaType mediaType, AVVideoSettings outputSettings) {
   super((SkipInit) null);
   initObject(init(mediaType, outputSettings.getDictionary()));
 }
Exemple #5
0
 /** @since Available in iOS 6.0 and later. */
 public static AVAssetWriterInput create(
     AVMediaType mediaType, AVVideoSettings outputSettings, CMFormatDescription sourceFormatHint) {
   return create(mediaType, outputSettings.getDictionary(), sourceFormatHint);
 }
Exemple #6
0
 public static AVAssetWriterInput create(AVMediaType mediaType, AVVideoSettings outputSettings) {
   return create(mediaType, outputSettings.getDictionary());
 }