QTMovieLayer and renderInContext:

  • Hi All,

    I am trying to use the CALayer renderInContext: call to put the
    contents of a QTMovieLayer instance onto a view, but I get a blank
    view - nothing renders.

    Is this call supposed to work for a QTMovieLayer?  I suppose the
    question could be expanded to: is the renderInContext: method
    supposed to work for any type of open-gl based layer class?

    Thanks,
    --
    John Clayton
    http://www.coderage-software.com/
  • :-)

    Scott, I guess you *may* have seen my DTS support request for
    CARenderer then? (I think it *is* very convoluted code [that I have],
    I cant get the thing to go, its all new to me - but I'm willing to
    learn).

    I will file a bug report for this then, I have a spike/test solution
    that demonstrates clearly that the rendering fails for a QTMovieLayer
    that is calling renderInContext:

    I guess I can fire you the question thats been hanging around in my
    head since day 1 then (about 8 months ago actually).  Q is this:  how
    would I use core-anim to render any CALayer tree onto a view, but only
    at a particular time (i.e. 2.6 seconds) and also make use of all the
    transitions and animations and so on [that core anim is good at
    doing]?  E.g. I have a complex CALayer and one of the contained layers
    has an animation at 2 seconds for a duration of 5 seconds that fades
    that layer out. (think: layers as movie timelines and using a slider
    to scrub back and forth in time).

    I've tried *a lot* of ways, and the basic problem appears to be
    telling layers that they should indeed render for time 't', regardless
    of what the CACurrentMediaTime() and underlying core-anim time-line is.

    Anyways, I'll file a bug report along with my spike solution and let
    you know its ID.

    --
    John Clayton

    On Nov 22, 2007, at 9:48 AM, Scott Anguish wrote:

    >
    > On Nov 22, 2007, at 3:22 AM, John Clayton wrote:
    >
    >> I'm not, that renderInContext: is a call on CALayer, allowing one
    >> to place the content of a layer into a CGContextRef
    >>
    >
    > Gah, sorry.  I miss read the original email. I should have
    > recognized the method, I wrote the reference doc for it.
    >
    >
    >> The CovertFlow example uses this technique to take content into a
    >> bitmap based context.
    >
    > Wow, it does.  but I wonder why.  It's just creating a bitmap with a
    > string in it.
    >
    > I'm not sure whose example that is, but I've asked engineering.
    >
    > If you determine that QTMovieLayer isn't rendering using that
    > method, please file a bug and let me know.
    >
    >
    >> I've got requirements to basically render arbitrarily complex
    >> CALayer hierarchies onto a view, but I want to render them for a
    >> particular time.
    >>
    >> What is CARenderer intended for then?  (I've used CARenderer in
    >> another different spike/test solution so have experience with it).
    >>
    >
    > Yes, that would be a CARenderer situation. I've only seen one
    > example of it in use and it was, shall we say, convoluted.
    >
    >> Thanks.
    >>
    >> --
    >> John Clayton
    >> http://www.coderage-software.com/
    >>
    >>
    >>
    >> On Nov 22, 2007, at 9:11 AM, Scott Anguish wrote:
    >>
    >>> I'm not sure of the answer..
    >>>
    >>> but why are you using CARenderer to put movie content into a view?
    >>>
    >>> it shouldn't be used for display purposes.
    >>>
    >>>
    >>> On Nov 22, 2007, at 1:47 AM, John Clayton wrote:
    >>>
    >>>> Hi All,
    >>>>
    >>>> I am trying to use the CALayer renderInContext: call to put the
    >>>> contents of a QTMovieLayer instance onto a view, but I get a
    >>>> blank view - nothing renders.
    >>>>
    >>>> Is this call supposed to work for a QTMovieLayer?  I suppose the
    >>>> question could be expanded to: is the renderInContext: method
    >>>> supposed to work for any type of open-gl based layer class?
    >>>>
    >>>> Thanks,
    >>>> --
    >>>> John Clayton
    >>>> http://www.coderage-software.com/
    >>>
    >>
    >
  • On Nov 22, 2007, at 4:07 AM, John Clayton wrote:

    > :-)
    >
    > Scott, I guess you *may* have seen my DTS support request for
    > CARenderer then? (I think it *is* very convoluted code [that I
    > have], I cant get the thing to go, its all new to me - but I'm
    > willing to learn).

    Nope, I'm not in DTS and we don't have access to the support requests.

    I've been asking around for a CARenderer example because my current
    method of making the movies for the documentation is not precise
    enough when it comes to start/stop times and timeline, etc. The one
    example I managed to get is really complicated, and I'm not sure what
    it's doing. This is always the problem with just grabbing someone
    else's test app, who knows what the => button does. :-)

    once I understand CARenderer I want to add an article to the CA
    Cookbook that describes what needs to be done.

    > I will file a bug report for this then, I have a spike/test solution
    > that demonstrates clearly that the rendering fails for a
    > QTMovieLayer that is calling renderInContext:
    >
    > I guess I can fire you the question thats been hanging around in my
    > head since day 1 then (about 8 months ago actually).  Q is this:
    > how would I use core-anim to render any CALayer tree onto a view,
    > but only at a particular time (i.e. 2.6 seconds) and also make use
    > of all the transitions and animations and so on [that core anim is
    > good at doing]?  E.g. I have a complex CALayer and one of the
    > contained layers has an animation at 2 seconds for a duration of 5
    > seconds that fades that layer out. (think: layers as movie timelines
    > and using a slider to scrub back and forth in time).\

    I wish I knew.  The one bit I've seen let's you pause an in progress
    animation and it'll do something when you push a button, but I have no
    idea exactly what the result is I'm getting in the example.  And I've
    not had time to figure it out from the code. (and the guy I got it
    from is out this week, so I can't ask him.  it's driving me crazy).

    >
    >
    > I've tried *a lot* of ways, and the basic problem appears to be
    > telling layers that they should indeed render for time 't',
    > regardless of what the CACurrentMediaTime() and underlying core-anim
    > time-line is.
    >

    I assume you've tried beginFrameAtTime:timeStamp:?

    the one bit I've got seems to

    [renderer beginFrameAtTime:timeInterval timeStamp:NULL];
    [renderer addUpdateRect:CGRectMake(0.0, 0.0, w, h)];
    [renderer render];

    in the -(void)drawInCGLContext:(CGLContextObj)glContext pixelFormat:
    (CGLPixelFormatObj)pixelFormat forLayerTime:
    (CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp

    implementation of an opengl layer. the open gl layer has the layers to
    render as it's sublayers.

    > Anyways, I'll file a bug report along with my spike solution and let
    > you know its ID.
    >

    Yes please!

    > --
    > John Clayton
    >
    > On Nov 22, 2007, at 9:48 AM, Scott Anguish wrote:
    >
    >>
    >> On Nov 22, 2007, at 3:22 AM, John Clayton wrote:
    >>
    >>> I'm not, that renderInContext: is a call on CALayer, allowing one
    >>> to place the content of a layer into a CGContextRef
    >>>
    >>
    >> Gah, sorry.  I miss read the original email. I should have
    >> recognized the method, I wrote the reference doc for it.
    >>
    >>
    >>> The CovertFlow example uses this technique to take content into a
    >>> bitmap based context.
    >>
    >> Wow, it does.  but I wonder why.  It's just creating a bitmap with
    >> a string in it.
    >>
    >> I'm not sure whose example that is, but I've asked engineering.
    >>
    >> If you determine that QTMovieLayer isn't rendering using that
    >> method, please file a bug and let me know.
    >>
    >>
    >>> I've got requirements to basically render arbitrarily complex
    >>> CALayer hierarchies onto a view, but I want to render them for a
    >>> particular time.
    >>>
    >>> What is CARenderer intended for then?  (I've used CARenderer in
    >>> another different spike/test solution so have experience with it).
    >>>
    >>
    >> Yes, that would be a CARenderer situation. I've only seen one
    >> example of it in use and it was, shall we say, convoluted.
    >>
    >>> Thanks.
    >>>
    >>> --
    >>> John Clayton
    >>> http://www.coderage-software.com/
    >>>
    >>>
    >>>
    >>> On Nov 22, 2007, at 9:11 AM, Scott Anguish wrote:
    >>>
    >>>> I'm not sure of the answer..
    >>>>
    >>>> but why are you using CARenderer to put movie content into a view?
    >>>>
    >>>> it shouldn't be used for display purposes.
    >>>>
    >>>>
    >>>> On Nov 22, 2007, at 1:47 AM, John Clayton wrote:
    >>>>
    >>>>> Hi All,
    >>>>>
    >>>>> I am trying to use the CALayer renderInContext: call to put the
    >>>>> contents of a QTMovieLayer instance onto a view, but I get a
    >>>>> blank view - nothing renders.
    >>>>>
    >>>>> Is this call supposed to work for a QTMovieLayer?  I suppose the
    >>>>> question could be expanded to: is the renderInContext: method
    >>>>> supposed to work for any type of open-gl based layer class?
    >>>>>
    >>>>> Thanks,
    >>>>> --
    >>>>> John Clayton
    >>>>> http://www.coderage-software.com/
    >>>>
    >>>
    >>
    >
  • On Nov 22, 2007, at 5:36 AM, Scott Anguish wrote:

    >
    > On Nov 22, 2007, at 4:07 AM, John Clayton wrote:
    >
    >> :-)
    >>
    >> Scott, I guess you *may* have seen my DTS support request for
    >> CARenderer then? (I think it *is* very convoluted code [that I
    >> have], I cant get the thing to go, its all new to me - but I'm
    >> willing to learn).
    >
    > Nope, I'm not in DTS and we don't have access to the support requests.

    whoops, didn't mean to send that to the list.
  • Hi John,

    I'm not sure that I understand the question but if all you want to do
    is put a movie layer into a view I have a simple example here that
    works for me;

    - (void)awakeFromNib {
        NSString *moviePath = @"your path here";
        NSError *error = nil;
        movie = [QTMovie movieWithFile:moviePath error:&error];
        [movie autoplay];
        QTMovieLayer *layer = [QTMovieLayer layerWithMovie:movie];
        [self setLayer:layer];
        [self setWantsLayer:YES];
    }

    This awakeFromNib is from my view class that takes up the whole
    window. The movie plays when the app starts.

    In the example (that I've not posted yet but will soon) on my blog I
    have a 'play' button that sits in the view that the movie plays on and
    it works like a champ.

    HTH,

    -bd-
    http://bill.dudney.net/roller/objc

    On Nov 21, 2007, at 11:47 PM, John Clayton wrote:

    > Hi All,
    >
    > I am trying to use the CALayer renderInContext: call to put the
    > contents of a QTMovieLayer instance onto a view, but I get a blank
    > view - nothing renders.
    >
    > Is this call supposed to work for a QTMovieLayer?  I suppose the
    > question could be expanded to: is the renderInContext: method
    > supposed to work for any type of open-gl based layer class?
    >
    > Thanks,
    > --
    > John Clayton
    > http://www.coderage-software.com/
  • Hi Bill, thanks for the input... buuuuuut:

    Nope, my aim is somewhat different.

    I need a movie in a view.  I want the frames of the movie to be in a
    layer.  I do *not* want it to autoplay, and I *do* want to tell the
    layer that the beginTime and duration are X and Y respectively, and I
    do want to be able to control the specific frame that is represented
    on the layer from that movie.

    Try thinking about putting a few movies across a timeline, and telling
    them to start/end at a particular time along that timeline.  This is
    what I'm trying to do.

    What I've got going so far:
    a) a QTMovieLayer (with INF/default duration), rendering a movie (NOT
    autoplay on construction)
    b) a slider on a view that tells the NSMovie what render time is, via
    the setCurrentTime:(QTTime) method.

    this works.  and I gotta say, beautifully.

    where it all breaks down is in the following:
    c) set the QTMovieLayers beginTime to something (anything)

    now nothing is rendered at all.

    So far, my belief/understanding is as follows - but please do feel
    free to enlighten me:

    When using (a) and (b), the Core Anim engine sees that the
    QTMovieLayer has an infinite duration, and thus, the movie is a valid
    candidate to be rendered by the Core Anim system.  Every time the
    'rendering time' is modified by the slider, the currentTime of the
    NSMovie is changed - and QTMovieLayer (being async in nature) renders
    the new frame properly.

    I'm still not clear why settings a beginTime (as in (c) above)) causes
    the animation to do nothing.

    --
    john

    On 22/11/2007, at 1:27 PM, Bill Dudney wrote:

    > Hi John,
    >
    > I'm not sure that I understand the question but if all you want to
    > do is put a movie layer into a view I have a simple example here
    > that works for me;
    >
    > - (void)awakeFromNib {
    > NSString *moviePath = @"your path here";
    > NSError *error = nil;
    > movie = [QTMovie movieWithFile:moviePath error:&error];
    > [movie autoplay];
    > QTMovieLayer *layer = [QTMovieLayer layerWithMovie:movie];
    > [self setLayer:layer];
    > [self setWantsLayer:YES];
    > }
    >
    > This awakeFromNib is from my view class that takes up the whole
    > window. The movie plays when the app starts.
    >
    > In the example (that I've not posted yet but will soon) on my blog I
    > have a 'play' button that sits in the view that the movie plays on
    > and it works like a champ.
    >
    > HTH,
    >
    > -bd-
    > http://bill.dudney.net/roller/objc
    >
    > On Nov 21, 2007, at 11:47 PM, John Clayton wrote:
    >
    >> Hi All,
    >>
    >> I am trying to use the CALayer renderInContext: call to put the
    >> contents of a QTMovieLayer instance onto a view, but I get a blank
    >> view - nothing renders.
    >>
    >> Is this call supposed to work for a QTMovieLayer?  I suppose the
    >> question could be expanded to: is the renderInContext: method
    >> supposed to work for any type of open-gl based layer class?
    >>
    >> Thanks,
    >> --
    >> John Clayton
    >> http://www.coderage-software.com/
    >
  • Ah,

    Sorry no enlightenment here...

    But my curiosity was piqued so I had to spend some time messing with
    it. I'm not surethis will help you but figured I'd share what I found
    in case it does.

    I tried setting the beginTime on my QTMovieLayer and what I get is
    every few frames are rendered (looks like ever beginTime'th frame) and
    all the audio is played. timeOffset does not appear to affect my video
    at all.

    HTH,

    -bd-
    http://bill.dudney.net/roller/objc

    On Nov 22, 2007, at 7:24 AM, John Clayton wrote:

    > Hi Bill, thanks for the input... buuuuuut:
    >
    > Nope, my aim is somewhat different.
    >
    > I need a movie in a view.  I want the frames of the movie to be in a
    > layer.  I do *not* want it to autoplay, and I *do* want to tell the
    > layer that the beginTime and duration are X and Y respectively, and
    > I do want to be able to control the specific frame that is
    > represented on the layer from that movie.
    >
    > Try thinking about putting a few movies across a timeline, and
    > telling them to start/end at a particular time along that timeline.
    > This is what I'm trying to do.
    >
    > What I've got going so far:
    > a) a QTMovieLayer (with INF/default duration), rendering a movie
    > (NOT autoplay on construction)
    > b) a slider on a view that tells the NSMovie what render time is,
    > via the setCurrentTime:(QTTime) method.
    >
    > this works.  and I gotta say, beautifully.
    >
    > where it all breaks down is in the following:
    > c) set the QTMovieLayers beginTime to something (anything)
    >
    > now nothing is rendered at all.
    >
    > So far, my belief/understanding is as follows - but please do feel
    > free to enlighten me:
    >
    > When using (a) and (b), the Core Anim engine sees that the
    > QTMovieLayer has an infinite duration, and thus, the movie is a
    > valid candidate to be rendered by the Core Anim system.  Every time
    > the 'rendering time' is modified by the slider, the currentTime of
    > the NSMovie is changed - and QTMovieLayer (being async in nature)
    > renders the new frame properly.
    >
    > I'm still not clear why settings a beginTime (as in (c) above))
    > causes the animation to do nothing.
    >
    > --
    > john
    >
    >
    > On 22/11/2007, at 1:27 PM, Bill Dudney wrote:
    >
    >> Hi John,
    >>
    >> I'm not sure that I understand the question but if all you want to
    >> do is put a movie layer into a view I have a simple example here
    >> that works for me;
    >>
    >> - (void)awakeFromNib {
    >> NSString *moviePath = @"your path here";
    >> NSError *error = nil;
    >> movie = [QTMovie movieWithFile:moviePath error:&error];
    >> [movie autoplay];
    >> QTMovieLayer *layer = [QTMovieLayer layerWithMovie:movie];
    >> [self setLayer:layer];
    >> [self setWantsLayer:YES];
    >> }
    >>
    >> This awakeFromNib is from my view class that takes up the whole
    >> window. The movie plays when the app starts.
    >>
    >> In the example (that I've not posted yet but will soon) on my blog
    >> I have a 'play' button that sits in the view that the movie plays
    >> on and it works like a champ.
    >>
    >> HTH,
    >>
    >> -bd-
    >> http://bill.dudney.net/roller/objc
    >>
    >> On Nov 21, 2007, at 11:47 PM, John Clayton wrote:
    >>
    >>> Hi All,
    >>>
    >>> I am trying to use the CALayer renderInContext: call to put the
    >>> contents of a QTMovieLayer instance onto a view, but I get a blank
    >>> view - nothing renders.
    >>>
    >>> Is this call supposed to work for a QTMovieLayer?  I suppose the
    >>> question could be expanded to: is the renderInContext: method
    >>> supposed to work for any type of open-gl based layer class?
    >>>
    >>> Thanks,
    >>> --
    >>> John Clayton
    >>> http://www.coderage-software.com/
    >>
    >
  • OK,

    Thanks for trying anyway Bill.  I do appreciate it.

    Just one part of the sentence below I didn't understand.  You said
    '...and what I get is every few frames rendered...', can you please
    explain in more detail what you did exactly, and whether or not you
    had the QTMovie playing or static?

    thanks

    --
    John Clayton
    http://www.coderage-software.com/

    On 23/11/2007, at 2:41 PM, Bill Dudney wrote:

    > Ah,
    >
    > Sorry no enlightenment here...
    >
    > But my curiosity was piqued so I had to spend some time messing with
    > it. I'm not surethis will help you but figured I'd share what I
    > found in case it does.
    >
    > I tried setting the beginTime on my QTMovieLayer and what I get is
    > every few frames are rendered (looks like ever beginTime'th frame)
    > and all the audio is played. timeOffset does not appear to affect my
    > video at all.
    >
    > HTH,
    >
    > -bd-
    > http://bill.dudney.net/roller/objc
    >
    > On Nov 22, 2007, at 7:24 AM, John Clayton wrote:
    >
    >> Hi Bill, thanks for the input... buuuuuut:
    >>
    >> Nope, my aim is somewhat different.
    >>
    >> I need a movie in a view.  I want the frames of the movie to be in
    >> a layer.  I do *not* want it to autoplay, and I *do* want to tell
    >> the layer that the beginTime and duration are X and Y respectively,
    >> and I do want to be able to control the specific frame that is
    >> represented on the layer from that movie.
    >>
    >> Try thinking about putting a few movies across a timeline, and
    >> telling them to start/end at a particular time along that
    >> timeline.  This is what I'm trying to do.
    >>
    >> What I've got going so far:
    >> a) a QTMovieLayer (with INF/default duration), rendering a movie
    >> (NOT autoplay on construction)
    >> b) a slider on a view that tells the NSMovie what render time is,
    >> via the setCurrentTime:(QTTime) method.
    >>
    >> this works.  and I gotta say, beautifully.
    >>
    >> where it all breaks down is in the following:
    >> c) set the QTMovieLayers beginTime to something (anything)
    >>
    >> now nothing is rendered at all.
    >>
    >> So far, my belief/understanding is as follows - but please do feel
    >> free to enlighten me:
    >>
    >> When using (a) and (b), the Core Anim engine sees that the
    >> QTMovieLayer has an infinite duration, and thus, the movie is a
    >> valid candidate to be rendered by the Core Anim system.  Every time
    >> the 'rendering time' is modified by the slider, the currentTime of
    >> the NSMovie is changed - and QTMovieLayer (being async in nature)
    >> renders the new frame properly.
    >>
    >> I'm still not clear why settings a beginTime (as in (c) above))
    >> causes the animation to do nothing.
    >>
    >> --
    >> john
    >>
    >>
    >> On 22/11/2007, at 1:27 PM, Bill Dudney wrote:
    >>
    >>> Hi John,
    >>>
    >>> I'm not sure that I understand the question but if all you want to
    >>> do is put a movie layer into a view I have a simple example here
    >>> that works for me;
    >>>
    >>> - (void)awakeFromNib {
    >>> NSString *moviePath = @"your path here";
    >>> NSError *error = nil;
    >>> movie = [QTMovie movieWithFile:moviePath error:&error];
    >>> [movie autoplay];
    >>> QTMovieLayer *layer = [QTMovieLayer layerWithMovie:movie];
    >>> [self setLayer:layer];
    >>> [self setWantsLayer:YES];
    >>> }
    >>>
    >>> This awakeFromNib is from my view class that takes up the whole
    >>> window. The movie plays when the app starts.
    >>>
    >>> In the example (that I've not posted yet but will soon) on my blog
    >>> I have a 'play' button that sits in the view that the movie plays
    >>> on and it works like a champ.
    >>>
    >>> HTH,
    >>>
    >>> -bd-
    >>> http://bill.dudney.net/roller/objc
    >>>
    >>> On Nov 21, 2007, at 11:47 PM, John Clayton wrote:
    >>>
    >>>> Hi All,
    >>>>
    >>>> I am trying to use the CALayer renderInContext: call to put the
    >>>> contents of a QTMovieLayer instance onto a view, but I get a
    >>>> blank view - nothing renders.
    >>>>
    >>>> Is this call supposed to work for a QTMovieLayer?  I suppose the
    >>>> question could be expanded to: is the renderInContext: method
    >>>> supposed to work for any type of open-gl based layer class?
    >>>>
    >>>> Thanks,
    >>>> --
    >>>> John Clayton
    >>>> http://www.coderage-software.com/
    >>>
    >>
    >
  • Sure,

    here is my awakeFromNib where I setup the movie and layer

    - (void)awakeFromNib {
        NSString *moviePath = [[NSBundle mainBundle]
    pathForResource:@"MyMovie" ofType:@"m4v"];
        NSError *error = nil;
        movie = [QTMovie movieWithFile:moviePath error:&error];
        QTMovieLayer *layer = [QTMovieLayer layerWithMovie:movie];
        layer.backgroundColor = [self black];
        layer.beginTime = 2.0f;
        [self setLayer:layer];
        [self setWantsLayer:YES];
    }

    and the play action;

    - (void)play:(id)sender {
        [movie play];
    }

    With the beginTime set to 2.0 seconds the movie is black for the first
    2 seconds (about, I did not time it) then a frame renders. Then it is
    black for 2 more seconds then it renders another frame. I tried
    setting this value to other values and the intermittent frame
    rendering seems to track with the beginTime property (i.e if I set it
    to 0.25 then I get a frame every .25 seconds).

    During the whole play back however the audio is rendering.

    If I set the timeOffset on the layer the playback happens from the
    beginning of the movie. IOW the timeOffset  property seems to have no
    affect on movie play back.

    HTH,

    -bd-
    http://bill.dudney.net/roller/objc

    > OK,
    >
    > Thanks for trying anyway Bill.  I do appreciate it.
    >
    > Just one part of the sentence below I didn't understand.  You said
    > '...and what I get is every few frames rendered...', can you please
    > explain in more detail what you did exactly, and whether or not you
    > had the QTMovie playing or static?
    >
    > thanks
    >
    > --
    > John Clayton
    > http://www.coderage-software.com/
    >
    >
    >
    > On 23/11/2007, at 2:41 PM, Bill Dudney wrote:
    >
    >> Ah,
    >>
    >> Sorry no enlightenment here...
    >>
    >> But my curiosity was piqued so I had to spend some time messing
    >> with it. I'm not surethis will help you but figured I'd share what
    >> I found in case it does.
    >>
    >> I tried setting the beginTime on my QTMovieLayer and what I get is
    >> every few frames are rendered (looks like ever beginTime'th frame)
    >> and all the audio is played. timeOffset does not appear to affect
    >> my video at all.
    >>
    >> HTH,
    >>
    >> -bd-
    >> http://bill.dudney.net/roller/objc
    >>
    >> On Nov 22, 2007, at 7:24 AM, John Clayton wrote:
    >>
    >>> Hi Bill, thanks for the input... buuuuuut:
    >>>
    >>> Nope, my aim is somewhat different.
    >>>
    >>> I need a movie in a view.  I want the frames of the movie to be in
    >>> a layer.  I do *not* want it to autoplay, and I *do* want to tell
    >>> the layer that the beginTime and duration are X and Y
    >>> respectively, and I do want to be able to control the specific
    >>> frame that is represented on the layer from that movie.
    >>>
    >>> Try thinking about putting a few movies across a timeline, and
    >>> telling them to start/end at a particular time along that
    >>> timeline.  This is what I'm trying to do.
    >>>
    >>> What I've got going so far:
    >>> a) a QTMovieLayer (with INF/default duration), rendering a movie
    >>> (NOT autoplay on construction)
    >>> b) a slider on a view that tells the NSMovie what render time is,
    >>> via the setCurrentTime:(QTTime) method.
    >>>
    >>> this works.  and I gotta say, beautifully.
    >>>
    >>> where it all breaks down is in the following:
    >>> c) set the QTMovieLayers beginTime to something (anything)
    >>>
    >>> now nothing is rendered at all.
    >>>
    >>> So far, my belief/understanding is as follows - but please do feel
    >>> free to enlighten me:
    >>>
    >>> When using (a) and (b), the Core Anim engine sees that the
    >>> QTMovieLayer has an infinite duration, and thus, the movie is a
    >>> valid candidate to be rendered by the Core Anim system.  Every
    >>> time the 'rendering time' is modified by the slider, the
    >>> currentTime of the NSMovie is changed - and QTMovieLayer (being
    >>> async in nature) renders the new frame properly.
    >>>
    >>> I'm still not clear why settings a beginTime (as in (c) above))
    >>> causes the animation to do nothing.
    >>>
    >>> --
    >>> john
    >>>
    >>>
    >>> On 22/11/2007, at 1:27 PM, Bill Dudney wrote:
    >>>
    >>>> Hi John,
    >>>>
    >>>> I'm not sure that I understand the question but if all you want
    >>>> to do is put a movie layer into a view I have a simple example
    >>>> here that works for me;
    >>>>
    >>>> - (void)awakeFromNib {
    >>>> NSString *moviePath = @"your path here";
    >>>> NSError *error = nil;
    >>>> movie = [QTMovie movieWithFile:moviePath error:&error];
    >>>> [movie autoplay];
    >>>> QTMovieLayer *layer = [QTMovieLayer layerWithMovie:movie];
    >>>> [self setLayer:layer];
    >>>> [self setWantsLayer:YES];
    >>>> }
    >>>>
    >>>> This awakeFromNib is from my view class that takes up the whole
    >>>> window. The movie plays when the app starts.
    >>>>
    >>>> In the example (that I've not posted yet but will soon) on my
    >>>> blog I have a 'play' button that sits in the view that the movie
    >>>> plays on and it works like a champ.
    >>>>
    >>>> HTH,
    >>>>
    >>>> -bd-
    >>>> http://bill.dudney.net/roller/objc
    >>>>
    >>>> On Nov 21, 2007, at 11:47 PM, John Clayton wrote:
    >>>>
    >>>>> Hi All,
    >>>>>
    >>>>> I am trying to use the CALayer renderInContext: call to put the
    >>>>> contents of a QTMovieLayer instance onto a view, but I get a
    >>>>> blank view - nothing renders.
    >>>>>
    >>>>> Is this call supposed to work for a QTMovieLayer?  I suppose the
    >>>>> question could be expanded to: is the renderInContext: method
    >>>>> supposed to work for any type of open-gl based layer class?
    >>>>>
    >>>>> Thanks,
    >>>>> --
    >>>>> John Clayton
    >>>>> http://www.coderage-software.com/
    >>>>
    >>>
    >>
    >
previous month november 2007 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    
Go to today