Autostart movie using QTkit

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

  1. langer5247 macrumors newbie

    Jul 11, 2007
    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. HiRez macrumors 603


    Jan 6, 2004
    Western US
    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. robbiehanson macrumors newbie

    Apr 25, 2006
    Missouri, US
    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:
  4. kainjow Moderator emeritus


    Jun 15, 2000
    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