You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "escully27 (via GitHub)" <gi...@apache.org> on 2024/04/03 01:09:50 UTC

Re: [I] Add support for recording video [cordova-plugin-camera]

escully27 commented on issue #816:
URL: https://github.com/apache/cordova-plugin-camera/issues/816#issuecomment-2033363051

   This is actually possible with current cordova-plugin-camera
   
   Just have to change the following function in CDVCamera.m
   
   ```
   + (instancetype) createFromPictureOptions:(CDVPictureOptions*)pictureOptions;
   {
       CDVCameraPicker* cameraPicker = [[CDVCameraPicker alloc] init];
       cameraPicker.pictureOptions = pictureOptions;
       cameraPicker.sourceType = pictureOptions.sourceType;
       cameraPicker.allowsEditing = pictureOptions.allowsEditing;
   
       if (cameraPicker.sourceType == UIImagePickerControllerSourceTypeCamera) {
           // We only allow taking pictures (no video) in this API.
           cameraPicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:cameraPicker.sourceType];
           // We can only set the camera device if we're actually using the camera.
           cameraPicker.cameraDevice = pictureOptions.cameraDirection;
           cameraPicker.videoQuality = UIImagePickerControllerQualityTypeHigh;
       } else if (pictureOptions.mediaType == MediaTypeAll) {
           cameraPicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:cameraPicker.sourceType];
       } else {
           NSArray* mediaArray = @[(NSString*)(pictureOptions.mediaType == MediaTypeVideo ? kUTTypeMovie : kUTTypeImage)];
           cameraPicker.mediaTypes = mediaArray;
       }
   
       return cameraPicker;
   }
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org