Pick only landscape video / image from photo library - ios

Is there a way to pick only landscape orientation videos from library in objective C ? Does the mediaTypes property has a way to pick only those vides that were recorded in landscape mode? Is there a way to show only landscape recorded videos from library in popOver? Or is there any workaround? This apple doc does not meet my requirement.
UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
mediaUI.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
mediaUI.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil]; //Any way to pick only landscape videos? Or is there any workaround?
mediaUI.allowsEditing = YES;
mediaUI.delegate = self;
self.popoverController = [[UIPopoverController alloc]
initWithContentViewController:mediaUI];
self.popoverController.delegate = self;
[self.popoverController presentPopoverFromRect:CGRectMake(250, self.videoMenuView.frame.origin.y-10, 40, 40) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

Related

Using Tesseract for iOS

Im using tesseract OCR and it only reads 300 dpi images, when i take photos using UIImage picker controller camera the images are in 72 dpi how can i take images in 300 dpi like the stock app in iOS?
I'm using Tesseract on an iPad with iOS7 and the following code successfully presents the UIImagePickerController and I get an image back that I can readily OCR with Tesseract:
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
iosPicker = [[UIImagePickerController alloc] init];
iosPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
iosPicker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeImage, nil];
iosPicker.allowsEditing = NO;
iosPicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
iosPicker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
iosPicker.modalPresentationStyle = UIModalPresentationFullScreen;
iosPicker.delegate = self;
[self presentViewController:iosPicker animated:YES completion:^{}];
}
Side note: iosPicker is an instance variable defined in the interface for the view controller.

how to load Video from ipad library in ipad app

I have an iPad app in which when I click on the button it opens a popover with the iPad library to see the photos and pics. I want that when I click the button it should also show video in that but it does not show videos.
In device when I see library it shows videos but when popover opens in app it does not show any video.
UIImagePickerController *pckrImage = [[UIImagePickerController alloc] init];
pckrImage.delegate = self;
if (isiPhone) {
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) {
pckrImage.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:pckrImage animated:YES];
}
}
else {
popOver = [[UIPopoverController alloc]initWithContentViewController:pckrImage];
[popOver presentPopoverFromRect:CGRectMake(450.0f, 825.0f, 10.0f, 10.0f) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
}
First Create normal popover then add this code to for button 'choose photo from gallery'
UIImagePickerController *imagePicker1 = [[UIImagePickerController alloc] init];
imagePicker1.contentSizeForViewInPopover=CGSizeMake(300, 200);
imagePicker1.delegate = self;
imagePicker1.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
Popcontroller = [[UIPopoverController alloc] initWithContentViewController:imagePicker1];
[Popcontroller presentPopoverFromRect:cell1.ButtonAddPicture.frame
inView:cell1.ButtonAddPicture.superview
permittedArrowDirections:UIPopoverArrowDirectionUp
animated:YES];
and for video add following line to above code
imagePicker1.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];

UIImagePickerController not respecting video maximum duration on iPad

I am trying to build an app that would let user pick and upload a video from the library on iPad. I need the max video length to be 30 sec.
I am using the following code:
UIImagePickerController *mediaPicker = [[UIImagePickerController alloc] init];
mediaPicker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie,(NSString *)kUTTypeImage,nil];
mediaPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
mediaPicker.videoQuality = UIImagePickerControllerQualityTypeIFrame960x540;
mediaPicker.videoMaximumDuration = 30.0f;
mediaPicker.delegate = self;
if (self.imagePickerPopOverController.popoverVisible) {
[self.imagePickerPopOverController dismissPopoverAnimated:YES];
}
self.imagePickerPopOverController = [[UIPopoverController alloc] initWithContentViewController:mediaPicker];
[self.imagePickerPopOverController presentPopoverFromBarButtonItem:self.navigationItem.rightBarButtonItem
permittedArrowDirections:UIPopoverArrowDirectionUp
animated:NO];
After the video has been picked, I expect the UIImagePickerController to show a trimmer to trim the video length to 30 sec (if its longer), but it does not.
Set this before you present the controller.
imagePickerController.allowsEditing = YES;

iPad camera popover preview wrong rotation and scale

I am showing the camera in a popover (on an iPad - the iPad app is locked to Lanscape Left) and the preview is in Portrait and the wrong scale. The code is below - I have worked out the rotation and added it, but the preview size is the too thin now.
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.videoQuality = UIImagePickerControllerQualityTypeMedium;
imagePicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
CGAffineTransform transformRotation = CGAffineTransformMakeRotation(270 * M_PI/180);
imagePicker.cameraViewTransform = transformRotation;
}
else
{
NSLog(#"Camera not available. Using photo library");
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
imagePicker.delegate = self;
_photoPopover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[_photoPopover presentPopoverFromRect:view.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
Turns out to be an issue with the way iOS 6.0 deals with rotation - its fixed in 6.1
I think this is the solution for ur question so u can follow the code as per this link provided below.
UIImagePickerController in Landscape
It will helps u a lot.Enjoy the coding.

How to Make UIImagePicker full screen with popover controller for ipad

I have seen other posts on this subject, but no valid solutions. Surely this is possible! I found one solution here that suggests presenting it from a container view controller. The code for that is commented out in my method below. This DOES create the fullscreen view, but the cancel/take photo buttons won't work then, and I can't seem to dismiss it properly. Is there really no simple elegant solution to this???? Please help! Here's my code:
-(IBAction)launchCamera:(id)sender
{
[self.popoverController dismissPopoverAnimated:YES];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
//fullScreenViewController = [[UIViewController alloc] init];
//fullScreenViewController.contentSizeForViewInPopover = CGSizeMake(768, 1024);
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
// Tried making the view full screen (or at least larger), but doesn't work...
//popoverController.contentViewController.contentSizeForViewInPopover = CGSizeMake(384, 512);
[imagePicker setTitle:#"camera"];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage];
imagePicker.delegate = self;
imagePicker.allowsEditing = NO;
//[fullScreenViewController.view addSubview:imagePicker.view];
// change imagePicker to fullScreenViewController here for full screen:
popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[popoverController setDelegate:self];
[popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}
I never could make the UIImagePicker work properly in full-screen, so I ended up using the AVFoundation framework to implement my own.

Resources