PDA

View Full Version : Autostart movie using QTkit




langer5247
Jul 11, 2007, 04:07 PM
for starters, i am brand new to mac development. I am using Xcode and cocoa. I have a video embedded into the application i am writing and i am using the QTkit famework to accomplish this.
How do I make the video autostart when the application loads?

Its probably right in front of me but i can't seem to figure it out.

Thanks!



HiRez
Jul 11, 2007, 08:08 PM
for starters, i am brand new to mac development. I am using Xcode and cocoa. I have a video embedded into the application i am writing and i am using the QTkit famework to accomplish this.
How do I make the video autostart when the application loads?There might be some autoplay attribute thingy you can set, but I couldn't find it, so what I would do is just call gotoBeginning: followed immediately by play: on the QTMovie object. Now you will first have to load the movie (unless you have a hard-coded movie path set in the Nib, but that's usually a bad idea), so you could do that by overriding applicationDidFinishLaunching: in your main controller class and calling your movie loading code from there.

robbiehanson
Jul 13, 2007, 03:09 PM
you could do that by overriding applicationDidFinishLaunching: in your main controller class and calling your movie loading code from there.

The above probably solved your problem. If you invoke the play method at this point, the movie will most likely start playing.

However, there is an exception to this. If you are playing stuff over the internet, or the movie is really really big, QTKit may not have enough of the movie loaded to begin playing it immediately. If this is the case, QTKit will broadcast notifications when enough is loaded to begin playing. See this post for a better explanation: http://deusty.blogspot.com/2007/02/qtmovie-tips.html

kainjow
Jul 13, 2007, 07:11 PM
See this post for a better explanation: http://deusty.blogspot.com/2007/02/qtmovie-tips.html

Awesome, thanks for the link. I was working with playing a streamed movie the other day, and I ended up using a timer to delay the playing of the movie, which is ugly.