Correcting Video Orientation in iOS - iphone

I am developing a video app in which user can merge different videos present in Asset Library. I am able to join the videos but I am facing the orientation issues.
For example, if a video is landscape right and other is landscape left, the second video will be joined upside down. Moreover, I have tried different codes available at stackExchange, however if i apply those codes to portrait videos, they can be transformed to landscape right but leaving black margins on the sides.
Is there any way that when I select a video to be inserted in my project, first its orientation should be checked, if it is other then landscape right, it should be rotated accordingly and in the end if the original video was portrait, the video should be resized as the native player do when we play a video in full screen mode.
Thanks in advance.

Related

Should I Record Video using DJI Osmo in Landscape or Portrait/Vertical Mode for iPhone Portrait Orientation

Im developing an iOS app that will only support portrait orientation. I’m recording a video for the app that will play in a continuous loop on the login/signup screen similar to Munchery’s app.
I’m using a DJI Osmo and an iPhone 7+ with Filmic to record the videos and I’m going to edit using FCP X and then play them using AVPlayer.
My question is when I shoot the videos should I shoot in landscape mode and then in FCP X edit them for portrait or just shoot in portrait to begin with?
It might seem like an odd question but this is my first time using the Osmo and iPhone 7+ to shoot anything and most videos using this setup are shot in landscape mode. I don’t want to shoot a bunch of scenes the wrong way then have to reshoot everything to fit the iPhones portrait mode since that’s the only orientation my app will support. But I don’t want to unnecessarily shoot in portrait when landscape will suffice.
DJI Osmo Portrait/Vertical Mode
I recorded my first videos in the DJI portrait/vertical mode position and every time I played them back on my phone they would look fine in iPhone's landscape orientation but in iPhone's portrait orientation the videos would play in the center with a black bar on the top and another black bar on the bottom of it.
I went to the DJI store in Manhattan and the very helpful rep said the problem was I needed to first lock my phone in portrait orientation before recording in the DJI's portrait/vertical mode position to prevent that problem from happening. He said since I didn't have it locked even the iPhone was in a portrait position it was still recording in landscape mode.
I then asked him about the video I recorded playing in a portrait orientation inside my app and he said the only way that would work correctly is to record the video in DJI's portrait/vertical mode position. I had to scrap everything I recorded and rerecord again -sigh.
Basically if your going to use the DJI and your iPhone to record a video that will play in your app and your app will only support portrait orientation then:
make sure you lock the phone in portrait orientation
position your DJI to record your vide in the portrait/vertical mode position

Play youtube full screen on landscape, but inline on portrait - on iPhone

I have a view with a UIWebView on half the size of the iPhone screen.
In this webview I embed youtube videos.
The app is only in portrait mode. Though I would like to see videos play also in landscape.
Now I want the following behaviour:
When in portrait, play inline, don't go full screen.
a. For that I use "webView.allowsInlineMediaPlayback=YES;"
b. I open the webview with this link: "www.youtube.com/embed/videoid?playsinline=1"
If the user rotates the screen to landscape, I'd like the video to go full screen.
If the user then rotates back to portrait, I'd like the video to get inline again.
The rotations shouldn't stop the video in the middle, or restart the play.
What should I do?
As the embedded videos use an undocumented MPInlineVideo(Fullscreen)ViewController, you can't use its API and switch to fullscreen.
I'd thus recommend playing around with the "allowFullScreen"-parameter for the iframe-tag.
If everything fails, you should always be able to change the frame-size of the web-view so that it covers the full screen. You'd have to use width/height 100% in the iframe then.
Disclaimer: This is an educated guess. I've not actually tried to implement it that way.

size mismatch while rotation ipad/iphone webview for youtube

I am working on YouTube Video playing application where i need to play videos through UIWebView its working fine when i m rotating the devices from portrait to landscape mode.But When i click The Zoom option(Zoom Option means through UIWebView) and trying to rotate the Screen from portrait to landscape mode its showing white Blank screen in bottom right corner.and in case of landscape to portrait at bottom part its showing white blank screen.please help me out.
I guess it has something do with your webviews background color. Anyway can you provide some screenshots to make it more clear.

iPhone movie recording and playing in wrong orientation

In my application I want to record a movie using the AVFoundation classes in the landscape (button right) orientation mode.
I set the camera preview layer orientation layer to the landscape orientation and everything looks as it should in the preview.
I record the video using the AVCaptureMovieFileOutput class.
BUT when I play the movie with MVMoviePlayer the video is shown as if I recorded it in portrait mode ! (though the player's interface is displayed in the right landscape orientation as it should)
It seems like the preview layer orientation only affects the view and not what being recorded by the camera.
So how can I record the movie so it will record with the right orientation ?
Thanks
BTW
I use the front camera for the recording
I still have this same problem. Only happens when recording with the front camera on iPhone 4. A recording made with the iPad 2's front camera plays back fine.
I also tried rotating the movie view while playing back, but somehow the transform property of the MPMoviePlayerController.view is ignored, or interpreted strangely (I can only get the playback to flip horizontally, but the image stays 90 degrees rotated...).
Any progress on this?

iPhone Camera pictures from UIImagePickerController are sideways

My application supports taking pictures from iPhone in portrait mode and upload to the server.
However, the pictures taken are appearing in sideways once uploaded to the server.
Please help!
-KC
Keep in mind that the image has an associated imageOrientation property that will determine the correct orientation to display the image.
Images captured used AV Foundation (at least using AVCapture, which I'm using) are taken in landscape mode, so you have to rotate them clockwise before sending to the server.