My app is in portrait view for the iPhone, but when I play a video I want to set the orientation to Auto to allow the user the choice to see it full screen or not. I have iOS Pro and have tried Handheld.PlayFullScreenMovie along with prime31’s etcetera 2 plugin that has movie player capabilities. I get the same results which is when right before the movie starts playing I set it to AutoRotation and on movie complete I set it back to Portrait. The autorotation works great but when the app comes back, it does not switch back to portrait, it stays in landscape if that’s where the movie left off. It not ONLY stays in Landscape but it flickers, so the UI keeps switching between LandscapeRight and LandscapeLeft even though I have never set it to Landscape anywhere. I tried having Unity wait a second before it switches UI hoping that would help but no luck. My code is below.
void _playMovie (string __mediaUrlStr)
{
Handheld.StartActivityIndicator();
_allowAutoRotation(true);
EtceteraTwoManager.moviePlayerDidFinishEvent += _moviePlayerDidFinishEvent;
EtceteraTwoBinding.playMovie( __mediaUrlStr, false, true, true );
}
private void _moviePlayerDidFinishEvent()
{
Debug.Log( "moviePlayerDidFinishEvent" );
_allowAutoRotation(false);
Handheld.StopActivityIndicator();
EtceteraTwoManager.moviePlayerDidFinishEvent -= _moviePlayerDidFinishEvent;
StartCoroutine(_delaySwitchView());
}
private void _allowAutoRotation( bool __statusBol )
{
Debug.Log ("_allowAutoRotation called..."+__statusBol);
if ( __statusBol)
{
Screen.orientation = ScreenOrientation.AutoRotation;
Screen.autorotateToLandscapeLeft = true;
Screen.autorotateToLandscapeRight = true;
Screen.autorotateToPortrait = true;
Screen.autorotateToPortraitUpsideDown = true;
}
else
{
Screen.autorotateToLandscapeRight = false;
Screen.autorotateToPortrait = false;
Screen.autorotateToPortraitUpsideDown = false;
Screen.autorotateToLandscapeLeft = false;
Screen.orientation = ScreenOrientation.Portrait;
}
}
IEnumerator _delaySwitchView ()
{
yield return new WaitForSeconds(1f);
ViewToMediatorSig.Dispatch(PrefabIdStr, "switchview");
}