Hi everyone,
We are having trouble overcoming an issue regarding video playback initial orientation. When the app is opened for the first time and a hardware video is played, it is in the wrong orientation but on device tilt, video adjusts to the correct orientation. Subsequent videos play with the correct orientation. The initial orientation is different between various device models (iphone 3G, iphone 4, ipad). This problem did not exist in our app until we updated to unity 3.1 (and is still present in 3.1.0f4).
On iPhone 4 with device held landscapeLeft video starts playback upside down but then rotate to correct orientation for the user to view the video.
On iPad (os4.2) with device held in landscapeLeft, video starts in portrait orientation (i.e. at 90 degrees), it does not correct the orientation itself - but if the user rotates the device it will update to the correct orientation.
On iPod Touch (4th gen) the video starts in correct orientation (and will re-orientate if the users rotates device) - this is the desired behaviour.
UPDATE
iOS 4.2 iPhone video does not exhibit this orientation problem, but iOS 4.1 does.
Contained within our “GameController”, which is part of the initial scene, we call the following lines within the Start() method (using javascript)
// Hardcoding the screen orientation
iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft;
// To prevent the black corners you get when rotating the device (this has been commented out, but our orientation issue remains)
iPhoneKeyboard.autorotateToPortrait = false;
iPhoneKeyboard.autorotateToPortraitUpsideDown = false;
iPhoneKeyboard.autorotateToLandscapeLeft = false;
iPhoneKeyboard.autorotateToLandscapeRight = false;
The following code is called to load video at the start of the next level load call
iPhoneUtils.PlayMovie(levels[level]["startCinematic"] as String, Color.black, iPhoneMovieControlMode.CancelOnTouch,iPhoneMovieScalingMode.AspectFit);
Within in the Unity IDE → inside player settings → settings for iOS → Default Orientation = LandscapeLeft
Our video file is a H.264 Baseline Profile Level 3.0 mp4 video (600 px wide by 400 px high)
What we are trying to achieve is getting the video on all devices to start playback in LandscapeLeft.
Is there something we need to do within Unity, or does something need to be fixed within the xcode script library MPMoviePlayerController or is it a iOS SDK issue? Is there Unity3 PlayMovie API that is not documented yet? (i.e something like the keyboard rotation configurations).
We recently updated to xcode 3.2.5 with the new iOS SDK 4.2 and updated our devices to iOS 4.2, but this did not solve the problem.
We believe this relates to the patch noted for Unity 3.1 release.
Unity iOS Fixes: Fixed video autorotation. Pinch zoom gesture now disabled during video playback.
Any help gratefully appreciated.
Adam.