views:

152

answers:

2

Greetings Friends,

I am trying to overlay the simple 2D game I am developing on top of a quicktime (.mov) movie. I do not have experience with this (or much game programming xp) so I'm wondering if anyone has had to deal with this problem before and, if so, how did you go about solving it?

I've been looking into the QuickTime API (QTKit) and it looks promising, but if there's a better way - one that could be extended to support live video streams, that'd be AMAZING.

The game uses CoreAnimation layers for game objects and currently has an image as the window background. So basically, I need to change that image into a movie. Thanks all, I appreciate the help and suggestions.

// < Mr. Buffalo >
A: 

I haven't done anything like this before, but look into QTMovieLayer.

… if there's a better way - one that could be extended to support live video streams, that'd be AMAZING.

QuickTime already supports live streams. (Apple keynotes used to be streamed, before they switched to podcasting them through the iTunes Store.)

Peter Hosey
A: 

I figured this out at some point yesterday. Pretty straight forward actually. However, I haven't looked into streaming video yet..

ApplicationController:

- (void) setupQTMovieLayer
{
    // Get the movie and make it loop (my test canned video is short so I loop it)
    QTMovie * movie = [QTMovie movieNamed:@"Sample.mov" error:nil];
    [movie setAttribute: [NSNumber numberWithBool:YES] forKey:QTMovieLoopsAttribute];

    // Create the movie on the (CALayer) backgroundLayer, make it sexy, and add it to our view atIndex:0
    // note: backgroundLayer is a property of this class
    backgroundLayer = [QTMovieLayer layerWithMovie:movie];
    backgroundLayer.masksToBounds = YES;
    [[contentView layer] insertSublayer:backgroundLayer atIndex:0];

    // Goto the beginning and play the movie
    [movie gotoBeginning];
    [movie play];
}
Buffalo