Knowing when a QT movie is done

  • I'm working on my first QT program and I'm having troubles figuring out when
    a particular movie clip ends.  I've got a list of paths that has my
    playlist, but I don't know how to figure out when each one ends so that I
    can start up the next one.  I've seen a few forum posts about a
    QTMovieDidEndNotification method, but the code is thin and the concept
    eludes me.

    The only way I can even think to handle it would be to keep a loop running
    while the movie is playing and break out of the loop when the current time
    of the movie catches up to the total time, and it's not working out well.
    Anyone have answers?

    _________________________________________________________________
    Stay in touch with old friends and meet new ones with Windows Live Spaces
    http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://sp
    aces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&
    mkt=en-us
  • First, read up on notifications if you haven't already. They're used
    throughout Cocoa (and Carbon, to a lesser extent) to send messages to
    objects that may not be directly aware about each other.

    http://developer.apple.com/documentation/Cocoa/Conceptual/Notifications/

    Then, once you have achieved notification enlightenment, you can
    modify the following code to suit your purposes. The code must run on
    the main thread--QuickTime is not thread-safe.

    /* add "self" to the list of observers for the notification you're
    listening to */
    [[NSNotificationCenter defaultCenter] addObserver: self selector:
    @selector(movieDidEnd:) name: QTMovieDidEndNotification object: nil];

    /* your selector callback, so to speak */
    - (void)movieDidEnd: (NSNotification *)notification {
    QTMovie *movie = [notification object];

    /* ... your code here ... */
    }

    -Jonathan Grynspan

    On 19-Oct-06, at 8:35 PM, Matthew Stone wrote:

    > I'm working on my first QT program and I'm having troubles figuring
    > out when a particular movie clip ends.  I've got a list of paths
    > that has my playlist, but I don't know how to figure out when each
    > one ends so that I can start up the next one.  I've seen a few
    > forum posts about a QTMovieDidEndNotification method, but the code
    > is thin and the concept eludes me.
    >
    > The only way I can even think to handle it would be to keep a loop
    > running while the movie is playing and break out of the loop when
    > the current time of the movie catches up to the total time, and
    > it's not working out well.  Anyone have answers?
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today