我昨天在某个时候发现了这一点。实际上很直接。但是,我还没有研究过流媒体视频..
应用控制器:
- (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];
}