Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity 5.1.1 - iOS Video Playback Issue iOS 6 & 7

Discussion in 'iOS and tvOS' started by ryanbailey, Jun 23, 2015.

  1. ryanbailey

    ryanbailey

    Joined:
    Sep 17, 2012
    Posts:
    4
    Hey everyone,

    I recently updated to Unity 5.1.1 and I noticed that my videos have not been playing full screen anymore on iOS 6 & iOS 7. They are in a small window to the bottom left of the screen & the done button is off screen. iOS 8 seems to be fine though. Attached is a screenshot of what I am seeing.

    Is this a known bug and does anyone have a temporary fix for it?

    Thanks!
     

    Attached Files:

  2. ryanbailey

    ryanbailey

    Joined:
    Sep 17, 2012
    Posts:
    4
    For anyone looking for a temporary solution. The onUnityUpdateViewLayout method in MPVideoPlayer.mm seems to be the culprit.

    The original code was setting the offset since rootview sizing is portrait & this is in landscape.
    Code (CSharp):
    1. - (void)onUnityUpdateViewLayout
    2. {
    3.     UIView* rootView = GetAppController().rootView;
    4.     self.frame    = movieView.frame    = rootView.bounds;
    5.     self.center    = movieView.center    = rootView.center;
    6. }
    A simple fix for my uses was to simply set the frame & center to the same as the movie view.
    Code (CSharp):
    1. - (void)onUnityUpdateViewLayout
    2. {
    3.     self.frame    = movieView.frame;
    4.     self.center    = movieView.center;
    5. }
    Hope that helps!
     
  3. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    Hi,

    The fix is in the works, thanks :)
     
  4. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,602
    from our tests it seems to be enough to kill center setting and just have
    self.frame = movieView.frame = rootView.bounds;
    can you please try it out?
     
  5. fschneider

    fschneider

    Joined:
    May 26, 2014
    Posts:
    42
    That works fine for me.
     
  6. almahdie

    almahdie

    Joined:
    Jul 29, 2015
    Posts:
    3
    Please , can you tell me where to find MPVideoPlayer.mm and edit it . cause I can't find it in my exported xcode folder .. it's odd .
    I use unity 4.6.7f1 and xcode 6.4 .. thanks
     
    Last edited: Aug 13, 2015
  7. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    You should be able to find 'MPVideoPlayer.mm' in Classes\Unity, but this has already been fixed and it should no longer be necessary to remove that line on the latest 5.1 build.
     
  8. rutz

    rutz

    Joined:
    Aug 21, 2013
    Posts:
    51
    I use 5.1.3f1 and MPVideoPlayer.mm is not quite the same.
    Code (csharp):
    1. - (void)onUnityUpdateViewLayout
    2. {
    3.     UIView* rootView = GetAppController().rootView;
    4.     self.frame = movieView.frame = rootView.bounds;
    5. }
    I change it to:
    Code (csharp):
    1. - (void)onUnityUpdateViewLayout
    2. {
    3.     self.frame = movieView.frame;
    4. }
    And it works!