How to record landscape video using portrait device - ios

How can I record a landscape video using a device that is in portrait orientation?
This means that previewLayer width > height
AVCaptureVideoOrientation.LandscapeLeft is not right.

There is a sample project of iOS in developer.apple.com
enter link description here
You need to use AVAssetWriter AVAssetWriterInput
You need to be focus in this method in the MovieRecorder.m
- (void)addVideoTrackWithSourceFormatDescription:(CMFormatDescriptionRef)formatDescription transform:(CGAffineTransform)transform settings:(NSDictionary *)videoSettings
You need to edit the code to do that

Related

Is it possible to autorotate AVPlayer even if the device turned on "Lock Portrait Orientation"?

I want to play a video with AVPlayerViewController() from Apple's AVKit framework. well, the video plays nicely, auto rotate works well and rotate smoothly. But, is it possible to autorotate that (so it could rotate to landscape or rotate to portrait, not just one of it) even if the device turned on "Lock Portrait Orientation" ?
What i mean for "Lock Portrait Orientation" is the one from device's Control Center like this : Lock Portrait Orientation

Capture API from CosmicMind-Material: Camera preview not correct

When CaptureController is being push using navigation controller, camera preview is always portrait. When going to landscape it won't reflect the camera preview. But when it's just a "self.present" it's okay like the sample project. How can I manipulate when orientation is landscape and the camera preview is also landscape. Captured image have correct orientation, just the camera preview.
Lanscape but the camera preview orientaion is portait - Sample image attached:
link here
Solved! This line fix the issue:
(capture.preview.layer as! AVCaptureVideoPreviewLayer).connection.videoOrientation = videoOrientation
Just put it in the delegate function
func capture(capture: Capture, didChangeFrom previousVideoOrientation: AVCaptureVideoOrientation, to videoOrientation: AVCaptureVideoOrientation)

How to make app rotate only when playing videos?

Im trying to the set the orientation of my app so that it rotates when it is playing a video. Changing the "Supported Interface Orientations" in info.plist changes the orientation for the whole app but I just want it to change orientation when a video is playing. Any ideas of how to do this?
You can use CoreMotion to detect the current interface orientation, and the only change interface orientation if your video is playing.
Try checking out the CMMotionManager class.
Alternatively, try checking out preferredInterfaceOrientationForPresentation on your UIViewController.

UIImagePickerController With Camera Option in landscape mode in iphone SDK

I'm going to use UIImagePickerController with source as a camera. by default when i'm capturing the image m able to take the picture in portrait mode. here the problem is that i'm not able to display the same view in landscape mode.
Is there any other way to open the camera in Landscape mode?
Thanks in advance.
First of all there is no way to open camera in Landscape mode So we have to customize views as per our need.
You have to add rotation transformation to picture which will match to landscape view. You can hard code it as ,
Blockquote
CGAffineTransformRotate(CGAffineTransformIdentity, 117.81)"
Blockquote

play video landscape Iphone sdk 3.2 4.0 with standard api

how to play video landscape with standard api?
video play only portrait !!!
change the app orientation landscape is not useful, because video start portrait forever.
i have a portrait app with a button, when pressed video must play landscape.
yourmoviecontrollername setOrientation:UIDeviceOrientationPortrait animated:NO];
is not allowed by Apple
Maybe the regular videoplayercontroller doesnt do landscape by itself...i would suggest using MPMoviePlayerViewController available in 3.2, you set it up and use view controllers presentMoviePlayerController method in order to display, should work fine for you. here is a ref MPViewcontroller

Resources