Unity iOS: Set Orientation for Handheld.PlayFullScreenMovie

Hi,

I am using following code to quickly switch from Portrait to landscape before playing video and then again back to portrait after video playing done.

IEnumerator playVideo() {
		Screen.orientation = ScreenOrientation.Landscape;
		yield return new WaitForSeconds(.1f); 
		yield return new WaitForEndOfFrame();
		Handheld.PlayFullScreenMovie (background_.lastTrackableVideoPath_, Color.black, FullScreenMovieControlMode.Full, FullScreenMovieScalingMode.AspectFit);
		Screen.orientation = ScreenOrientation.Portrait;
		yield return new WaitForSeconds(.1f); 
	}

Above code is not working and video is always played in portrait. I have iOS 6.0.

Any idea why this is happening?

In my case I had a portrait app and wanted to play the video in landscape. I managed to solve it this way:

protected IEnumerator PlayBackRoutine(){
		blackbgImage.SetActive (true);
		Screen.orientation = ScreenOrientation.Landscape;
		while (Screen.currentResolution.height > Screen.currentResolution.width) {
			yield return null;
		}
		Handheld.PlayFullScreenMovie ("http://videourl.mp4");
		yield return null;
		Screen.orientation = ScreenOrientation.Portrait;
		while (Screen.currentResolution.height < Screen.currentResolution.width) {
			yield return null;
		}
		blackbgImage.SetActive (false);
	}

I created a black image that occpies all the screen called blackbgImage. So i show it before changing to landscape, switch to landscape, wait until the switch is done, play the video, wait 1 frame, switch to portrait, wait until the switch is done and unshow the image.

The result is super neat, i couldnt notice the difference between this and a native app.

Try using LandscapeLeft or LandscapeRight. Landscape is not a valid ScreenOrientation.

You need to put two copies of

yield return new WaitForEndOfFrame();

After the PlayFullScreenMovie or else it will switch to portrait before the video finishes.