Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Adquizition · Jun 05, 2015 at 06:15 AM · iosorientationautorotation

Having issues with ScreenOrientation.Portrait to Screen.AutoOrientation and Back to Portrait

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");
 }




Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Adquizition · Jun 05, 2015 at 12:07 AM 0
Share

To be clear, this is not a problem with prime31 as I have the same problem with the code below:

 protected IEnumerator CoroutinePlay$$anonymous$$ovie(string __mediaUrlStr)
 {
        _allowAutoRotation(true);
     Handheld.StartActivityIndicator();
 
     Handheld.PlayFullScreen$$anonymous$$ovie (__mediaUrlStr, Color.black, FullScreen$$anonymous$$ovieControl$$anonymous$$ode.Hidden, FullScreen$$anonymous$$ovieScaling$$anonymous$$ode.AspectFit);
     _allowAutoRotation(false);
 }


1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by danw_unity · Jun 18, 2015 at 03:13 PM

Hi,

We have a known bug that has similar symptoms to this: http://issuetracker.unity3d.com/issues/ios-8-dot-3-sdk-causes-orientation-to-reverse-on-every-frame-after-unity-ads-is-closed

It's not certain to be the same issue, but I mentioned it so you can track its progress and vote for it if you like.

I can't say when that will be fixed, so for a workaround could you use the recommendation here? http://docs.unity3d.com/Manual/class-MovieTexture.html (see "The video player does not respect the device’s orientation"). The trouble is, the user would be holding the device in portrait mode initially, so playback would start in that mode. You could just restart the video in landscape mode if they changed orientation; it depends how long it is etc.

I hope this helps,

Dan, Unity Support

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

"Powered by Unity" splash orientation faces landscape on iPhone even when portrait is included in autorotation 1 Answer

Autorotate ... but only on certain scenes? 0 Answers

Lock splash screen to portrait on iPad 0 Answers

iOS8 Screen Orientation Change 0 Answers

App starts in Portrait mode on iPhone 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges