1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Autostart movie using QTkit

Discussion in 'Mac Programming' started by langer5247, Jul 11, 2007.

  1. macrumors newbie

    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.

  2. macrumors 601


    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.
  3. macrumors newbie

    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
  4. Moderator emeritus


    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.

Share This Page