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

Weird bug with iPhoneUtils.PlayMovie

Discussion in 'iOS and tvOS' started by gfoxworthy, Jan 4, 2012.

  1. gfoxworthy

    gfoxworthy

    Joined:
    Nov 4, 2010
    Posts:
    24
    Hello all -

    I have a strange issue that I have not had on previous iOS projects for iPad2. When I press a button to play a movie using "iPhoneUtils.PlayMovie()", everything works great, the movie plays with no issues at all. Upon completion, or when I press the Done button, the movie goes away as expected, and the game window reappears and is animating as before.

    This is where the weird issue begins. When I touch anywhere on the screen (the button, or any other 'dead' area on screen), the video launches again. In other words, no matter where I touch, it behaves as if the video button were touched. I verified that the button (ppBtn) does not change size or position after the movie closes.

    Here's the code that launches the video: (Note: we are using xtuio).

    Code (csharp):
    1.  
    2. public void bgTouchDown(BBTouchEvent aTouch)
    3.     {
    4.         if (!locked)
    5.         {
    6.             Ray r = _orthoCamera.ScreenPointToRay(aTouch.screenPosition);
    7.             RaycastHit hit;
    8.             if (Physics.Raycast(r, out hit, 50, 1 << orthoLayer))
    9.             {
    10.                 string name = hit.collider.name;
    11.                
    12.                 if (name == "ppBtn")
    13.                 {
    14.                     string source = xml.DocumentElement.SelectSingleNode("//video").Attributes["src"].Value;
    15.             iPhoneUtils.PlayMovie(source, Color.black, iPhoneMovieControlMode.Full);
    16.                 }
    17.             }
    18.         }
    19.     }
    20.  
    Does anybody have any suggestions?
     
  2. gfoxworthy

    gfoxworthy

    Joined:
    Nov 4, 2010
    Posts:
    24
    I was able to solve the issue - I simply moved the code from bgTouchDown to bgTouchUp, and it works like a charm now.