Hello,
is there a way to find out if a Movie is finished playback ?
I want to playback 9 Videos one after one and loop it until the user close the Movieplayer.
I don’t want to waste the Space and make a new Movie from the 9…
thank you very much
Yupp there is: check movie.IsPlaying in a loop in a coroutine
Thank you
dreamora !
@ dreamora…
does not work…
function playShowroom () {
while (true) {
if (!movie.IsPlaying){
Vindex+=1;
iPhoneUtils.PlayMovie(Showroom[Vindex], Color.black, iPhoneMovieControlMode.Full);
yield;
}
}
That’s not gonna work. He was referring to MovieTexture.IsPlaying, but those aren’t even supported on the iPhone. But to answer your question: no there is no way to do it without writing some obj-c in Xcode.
But if you wanted to write some xcode, here’s one way of doing it:
Whenever the iPhoneUtils.PlayMovie() movie finishes playing, it fires the notification “MPMoviePlayerPlaybackDidFinishNotification” through NotificationCenter. So just register one of your objects for this notification. Here’s a link to all movie notification’s you can receive:
Correct my error, missed that it was in the iOS category.
You will indeed need to offload the whole movieplaying to objc code so you can hookup an event handling functionality to send in the information that its done. but keep in mind: this would still be 1 frame late at very least - so you might want to expand your play functionality to allow to define the whole movie sequence and let objc handle the hole thing from start to end
Thank you for clearing !!!
so someone in the IRC mention that this will work:
function playShowroom () {
iPhoneUtils.PlayMovie(Showroom[1], Color.black, iPhoneMovieControlMode.Full);
iPhoneUtils.PlayMovie(Showroom[2], Color.black, iPhoneMovieControlMode.Full);
iPhoneUtils.PlayMovie(Showroom[3], Color.black, iPhoneMovieControlMode.Full);
}
but well there is no documentation and it look’s like it doesn’t work in Unity 3.3…
after i fire iPhoneUtils.PlayMovie() it looks after the Playback is finished to the next line in that function…
but nothing happened…
damn… don’t want to write a extra plugin for that…
I’ve made a request again for better handling of Video on iOS… also Movie Playback on Textures… it’s possible !
a lot is possible.
But getting a non laughable movie support has been requested for unity pro since 2.0, so I wouldn’t hold my breath and invest the 4 hours to write it, really