Unity 3.1 iPhone video orientation

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.

Please can you file a bug report for this (menu: Help > Report A Bug).

Hi Andeeee,

Will do as you suggest, however I am unsure if this is related to our code inside unity or if its an external issue outside of unity ie: a solution may exists inside xcode.

Cheers.

Adam.

Dragonian please make sure to post back if you find anything.

After updating to iOS 4.2, the problem was fixed for all our devices except the iPad, which continued to launch the video in portrait orientation.

After some investigation, we found that if no splash images were set for the iPad Portrait and iPad Landscape in Player Setting → Splash Image, then the problem with video launching in portrait orientation did not occur.

After setting these to none and building to device, the video launched in correct orientation (LandscapeLeft).

We where able to repeat this issue with a new test project. I will file a bug report regarding our findings.

Afternoon everyone,

I’m having this same issue on my devices. Using Unity 3.1 and the latest/greatest SDK. I have the app set to Landscape Left in the player prefs and i am using iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft; anywhere i start new scenes (in the start function).

The way our game is currently setup is that we run the initial load through a loader scene which contains iPhone.PlayMovie. When the movie plays is immediately oriented in portrait and the users able to rotate it back and forth between portrait and landscape. My initial startup function is as follows…

function Start() 
{
	iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft;
	iPhoneUtils.PlayMovie("intro_hi.m4v", Color.black, iPhoneMovieControlMode.CancelOnTouch);
	yield;
	Application.LoadLevel("title");
}

After that whenever i go to any level i’m getting the nice black rotating bars everywhere… the game launches correctly in Landscape left, and never deviates from that… outside of the rotating black bars/boxes that come up.

I’m using iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft; at the start of every level.

Any help would be greatly appreciated… kinda confused on whats going on w/it.
Cheers
Bryan

Bump~~
How to get it?

Still can’t!

Thanks

Can you for the hell of it stop to bump every damned thread on iOS 4 + Movie Orientation?
Do you really think anyone is going to do anything but curse you to netherworld for your annoying spaming?

Pay someone to implement you a solution if the 15 threads you necromanced didn’t answer your questions yet.

Oh.sorry…I’m anxious.
I stopped bump.