I am developing an app in which I am taking a video from photo-library.
the video may be taken in portrait or in landscape mode.
I want to know the orientation of video so that based on that i can rotate stand play it in MPMoviePlayerController.
I did try it with AVAssetImageGenerator but its taking time and sometimes not generating image as required.
Related
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
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.
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?
I am loading a YouTube video link in UIWebView and when I click the play button, it launches the Quicktime player and plays the video in it. The issue here is that the default orientation of the Quicktime player is Portrait--I want it to be in Landscape mode.
Even though my base view and the webview are both in landscape mode, Quicktime player still gets launched in portrait mode.
I thought I could get the access to the default quicktime player and change its orientation to landscape.
May be this is not the case, but what about intercepting the click on the link and play the video using mpmovieplayercontroller?
That's only a suggestion and probably not a real answer to your problem.
Good luck!
What I have to do is play a video file in mp4 format. If the device is in portrait mode then it should display the video, but when the user changes the device to landscape mode it should just show an image.
But currently when I play a video, it takes control of the whole app; I can't send a notification to any event, and control only returns to my code after playing the full length video.
How can we can access another things while we are playing the video on the device?
Thanks for the help
Balraj Verma
Try spawning a new thread and then call the code to play the video from the new thread. This should leave the rest of your code free to do what it needs, unless I am misunderstanding your question.
You can use the shouldAutorotateToInterfaceOrientation: to check what orientation the device is in, and then do the logic in there.
Eg, if the orientation is portrait, start the MPMoviePlayerController playing the movie, then when the orientation changes to landscape, dismiss the moviePlayer.