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 LouiseW · Jul 16, 2013 at 12:25 PM · ioshandheldautorotationplaymovie3.5.7

iOS: Play video in Landscape, rest in Portrait

Hi!

We are developing an app (with lots of videos) that we want to render in Portrait mode, except when playing a video. We would like the orientation to be on Autorotate, or at least LandscapeLeft, when a video is playing but can't get this to work at all.

I've searched a lot for answers on this but can't find anything that will work for us. Setting "Screen.orientation = ScreenOrientation.LandscapeLeft" in code before playing a video doesn't work. Neither does changing the orientation setting in "Player Settings" in Unity; it just messes up the UI when not playing a video.

Any help would be very much appreciated! Our release date is very very soon and being forced to play videos in Portrait mode is a major drawback for our app, considering videos is one of the biggest features in it.

Unity version: 3.5.7

//Louise

Comment
Add comment · Show 7
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 kenny_cj · Aug 27, 2015 at 08:47 PM 0
Share

Did you ever find the solution to this issue ? I am using Unity 5 now and I have the exact same issue.

Thanks.

avatar image LouiseW · Aug 28, 2015 at 09:13 AM 0
Share

kenny_cj: I'm sorry but I have kinda forgotten how I solved this (it was 2 years ago). One thing comes to $$anonymous$$d though, I think I had "Autorotation" on in Player Settings and then I controlled the orientation in code (Portrait at start of app, Autorotation right before playing a movie then back to Portrait after played movie). Back then there was some kind of bug with setting the rotation in Player Settings I think. I'm sorry I can't be of more help!

//Louise

avatar image wjp1989_ LouiseW · Sep 26, 2016 at 08:02 AM 0
Share

as you said , i set oritation landscape before play , and reset it to portrait follow the Handheld.PlayFullScreen$$anonymous$$ovie . the video still play on the portrait mode. could you tell me what should i do ?

avatar image LouiseW wjp1989_ · Sep 26, 2016 at 02:01 PM 0
Share

This was years ago now but I think I did set it to Landscape mode by ivoking my own "Play$$anonymous$$ovie()" function 0.5 seconds (or something) after I set the orientation to Landscape. Then, after the movie has finished playing, I put it back to Portrait by invoking my own "SetOrientationToPortrait()" function after like 0.5-1.0 seconds. This is to make sure Unity has time to finish Handheld.PlayFullScreen$$anonymous$$ovie() before trying to set the orientation to Portrait.

With invoking I mean Unity's Invoke() function:

 void Start()
 {
    Screen.orientation = ScreenOrientation.LandscapeLeft;
    Invoke("Play$$anonymous$$ovie", 0.5f);
 }
 
 private void Play$$anonymous$$ovie()
 { 
    Handheld.PlayFullScreen$$anonymous$$ovie(...);
    Invoke("SetOrientationToPortrait, 0.5f);
 }
 
 private void SetOrieantationToPortrait()
 {
    Screen.orientation = ScreenOrientation.Portrait;
 }

Haven't tried this code but I believe I did something like that. Good luck!

Show more comments
Show more comments
avatar image kenny_cj · Aug 28, 2015 at 01:30 PM 0
Share

Thanks for the reply Louise. In the end, I added a WaitForSeconds in my coroutine just after setting the screen orientation to make sure that the orientation change was right before playing the video.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Graham-Dunnett · Jul 16, 2013 at 03:39 PM

There is code in AppController.mm that handles the movie viewer, search for video view controller. It's possible that changing some of the logic there for handling the orientation of the UnityVideoViewController will achieve what you want. Alternatively, rotate the video before you render it out, so the video is portrait and not landscape. When you play a portrait video back in a portrait game, it'll look landscape, if you get what I mean.

(Have you checked that playing back landscape video when the game is portrait is acceptable to Apple?)

Comment
Add comment · Show 1 · 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
avatar image LouiseW · Jul 16, 2013 at 05:47 PM 0
Share

Thanks for quick answer Dunnett! Sadly, we've already tried changing some stuff in AppController.mm but without success. If someone could pin-point something critical in AppController.mm related to our problem that we could try changing, it would be great though.

About rotating the video before rendering: do you mean rotating the video in an editing program beforehand? We considered that too, but the video controller (which is very necessary in our kind of app) will still be in Portrait mode, which would look a bit ugly.

(Haven't checked with Apple yet but our app is not a game and I would be very surprised if they wouldn't accept it. You never know though, I guess. x))

avatar image
0

Answer by rohankad · Aug 28, 2015 at 10:23 AM

@LouiseW If you're using Handhed.PlayFullScreenMovieAPI to play, then you can use the parameter

 FullScreenMovieScalingMode fs = FullScreenMovieScalingMode.Application.DeviceOrientation

It's mentioned here http://docs.unity3d.com/ScriptReference/Handheld.PlayFullScreenMovie.html

I never tried this thing, hope you'll get some idea about changing it on runtime from the above link.

Thanks

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
avatar image
0

Answer by vfxjex · Aug 04, 2016 at 12:54 PM

Uncheck the Portrait orientation and that should make the movie to land scape

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

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Handheld.PlayFullScreenMovie not working on iOS with Cloud Build 0 Answers

Help me step by step to make video play on mobile! 2 Answers

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

Best solution for the iOS6 autorotation issue 1 Answer

"Powered by Unity" splash orientation faces landscape on iPhone even when portrait is included in autorotation 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