You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/10/04 23:26:54 UTC
[GitHub] jcesarmobile closed pull request #48: Added support for video
quality option on iOS platform.
jcesarmobile closed pull request #48: Added support for video quality option on iOS platform.
URL: https://github.com/apache/cordova-plugin-media-capture/pull/48
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/README.md b/README.md
index 4bdc3da..21b43e0 100644
--- a/README.md
+++ b/README.md
@@ -367,6 +367,9 @@ capturing a video clip, the `CaptureErrorCB` callback executes with a
- The __limit__ property is ignored. Only one video is recorded per invocation.
+- iOS supports an additional __quality__ property, to allow capturing video at different qualities. A value of `1` ( the default ) means high quality and value of `0` means low quality, suitable for MMS messages.
+ See [Apple documentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImagePickerController_Class/#//apple_ref/c/tdef/UIImagePickerControllerQualityType) for more details.
+
### Android Quirks
- Android supports an additional __quality__ property, to allow capturing video at different qualities. A value of `1` ( the default ) means high quality and value of `0` means low quality, suitable for MMS messages.
diff --git a/src/ios/CDVCapture.m b/src/ios/CDVCapture.m
index 1be2622..9c4ff7d 100644
--- a/src/ios/CDVCapture.m
+++ b/src/ios/CDVCapture.m
@@ -58,17 +58,17 @@ - (uint64_t)accessibilityTraits
- (BOOL)prefersStatusBarHidden {
return YES;
}
-
+
- (UIViewController*)childViewControllerForStatusBarHidden {
return nil;
}
-
+
- (void)viewWillAppear:(BOOL)animated {
SEL sel = NSSelectorFromString(@"setNeedsStatusBarAppearanceUpdate");
if ([self respondsToSelector:sel]) {
[self performSelector:sel withObject:nil afterDelay:0];
}
-
+
[super viewWillAppear:animated];
}
@@ -223,6 +223,7 @@ - (void)captureVideo:(CDVInvokedUrlCommand*)command
// taking more than one video (limit) is only supported if provide own controls via cameraOverlayView property
NSNumber* duration = [options objectForKey:@"duration"];
NSString* mediaType = nil;
+ NSNumber* quality = [options objectForKey:@"quality"];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
// there is a camera, it is available, make sure it can do movies
@@ -263,7 +264,13 @@ - (void)captureVideo:(CDVInvokedUrlCommand*)command
// iOS 4.0
if ([pickerController respondsToSelector:@selector(cameraCaptureMode)]) {
pickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
- // pickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
+
+ if ([quality intValue] == 0) {
+ pickerController.videoQuality = UIImagePickerControllerQualityTypeLow;
+ } else {
+ pickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
+ }
+
// pickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear;
// pickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
}
@@ -337,7 +344,7 @@ - (void)getMediaModes:(CDVInvokedUrlCommand*)command
movieArray ? (NSObject*) movieArray:[NSNull null], @"video",
audioArray ? (NSObject*) audioArray:[NSNull null], @"audio",
nil];
-
+
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:modes options:0 error:nil];
NSString* jsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
@@ -608,7 +615,7 @@ - (void)loadView
if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) {
self.edgesForExtendedLayout = UIRectEdgeNone;
}
-
+
// create view and display
CGRect viewRect = [[UIScreen mainScreen] applicationFrame];
UIView* tmp = [[UIView alloc] initWithFrame:viewRect];
@@ -736,7 +743,7 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
UIInterfaceOrientationMask orientation = UIInterfaceOrientationMaskPortrait;
UIInterfaceOrientationMask supported = [captureCommand.viewController supportedInterfaceOrientations];
-
+
orientation = orientation | (supported & UIInterfaceOrientationMaskPortraitUpsideDown);
return orientation;
}
@@ -745,7 +752,7 @@ - (NSUInteger)supportedInterfaceOrientations
{
NSUInteger orientation = UIInterfaceOrientationMaskPortrait; // must support portrait
NSUInteger supported = [captureCommand.viewController supportedInterfaceOrientations];
-
+
orientation = orientation | (supported & UIInterfaceOrientationMaskPortraitUpsideDown);
return orientation;
}
@@ -793,7 +800,7 @@ - (void)processButton:(id)sender
}
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
};
-
+
SEL rrpSel = NSSelectorFromString(@"requestRecordPermission:");
if ([self.avSession respondsToSelector:rrpSel])
{
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org