Movies playback did finish in unity

Hi all,
I’m using iPhoneUtils.PlayMovie inside unity to play some movies and I need to know when the current movie finish playing.

There’s any way to link the movie to a notification like the MPMoviePlayerPlaybackDidFinishNotification in Objective-C?

Thank you

from what I understand, Unity is placed in the background and stops running when you call iPhoneUtils.PlayMovie as it uses the movie player built into the iphone/ipod. when the movie finishes, unity picks up where it left off.

so It’ll just be the next call to the update function after a “playmovie” call?
in that case, there’s any way to know if the user has cancelled the playback by pressing the touch or if he watched all the movie?

Yes, to the first question.

for the second question: i don’t believe so. i suppose you can kinda fudge it by getting Time.time before you play the movie and then again afterwards. if the difference between the two calls to Time.time are equal to the length of the movie then they watched the whole thing. if its less, that means they interrupted it.

-edited to clarify answer

pulled from the Unity iPhone doc.

“Calling this function will pause Unity during movie playback. When playback finishes Unity will resume.”

I’m refreshing this topic, because I haven’t found solution yet. Information from Unity documentation isn’t helpful because it’s simply not true… or there’s a bug, or I am doing something wrong.
I want to play intro at the very beginning. Here’s my code:

    void Start()
    {
        iPhoneUtils.PlayMovie(introName, Color.black, iPhoneMovieControlMode.Full, iPhoneMovieScalingMode.None);
        Application.LoadLevel(nextLevelName);
    }

Unity loads next scene (which simply shows splash screen), then loads another one and then finally plays movie. Moving PlayMovie() from Start() to Update() doesn’t help either.

the movie play happens asyncronous (through the iphone media player), so the code will immediately continue.

what you need to do is wait with the loadlevel until the movie paying has ended

Thanks, but is there any way to check if video playback has finished? I can’t find it in documentation neither on forum.

Actually i did the same in my last project

function Update() {
if ((iPhoneInput.touchCount > 0 || Input.GetMouseButtonDown(0) == true) go == false) {
// Es gibt eine Toucheingabe
go = true;
startVideo();
}
}
function startVideo() {
iPhoneUtils.PlayMovie(“themovie.m4v”, Color.black, iPhoneMovieControlMode.CancelOnTouch);
Application.LoadLevel (“start”);
}

works just fine. level seems to be loaded after movie quits.
in case this doesnt work for you try writing yield new WaitForSeconds(3); after the playmovie command

that would be useful if i pressed the home button and get back to my game , in this case i need entire frame or the current second to know what i will load or wait while im finish playing video !!!