• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: QTMovieLayer and renderInContext:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QTMovieLayer and renderInContext:


  • Subject: Re: QTMovieLayer and renderInContext:
  • From: Bill Dudney <email@hidden>
  • Date: Fri, 23 Nov 2007 08:27:18 -0700

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/


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com


Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >QTMovieLayer and renderInContext: (From: John Clayton <email@hidden>)
 >Re: QTMovieLayer and renderInContext: (From: Bill Dudney <email@hidden>)
 >Re: QTMovieLayer and renderInContext: (From: John Clayton <email@hidden>)
 >Re: QTMovieLayer and renderInContext: (From: Bill Dudney <email@hidden>)
 >Re: QTMovieLayer and renderInContext: (From: John Clayton <email@hidden>)

  • Prev by Date: Re: NSOpenGLView - forcing an update.
  • Next by Date: Re: Overlapping Views
  • Previous by thread: Re: QTMovieLayer and renderInContext:
  • Next by thread: Adding and removing application to the dock programmatically.
  • Index(es):
    • Date
    • Thread