UICollectionViewCell で再生する mp4 ムービーを取得しようとしています。私はそれを表示する運がありません。だから、私の最初の質問は: これは可能ですか? もしそうなら、私は何を間違っていますか?これは ARC 以外のプロジェクトであり、XIB やストーリーボードは使用していません...
NSURL * theURL = nil;
NSBundle * bundle = [NSBundle mainBundle];
if (bundle)
{
NSString * thePath = [bundle pathForResource:@"intro" ofType:@"mp4"];
if ( thePath )
{
theURL = [NSURL fileURLWithPath:thePath];
}
}
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL: theURL];
[player prepareToPlay];
[player.view setFrame: self.contentView.bounds]; // player's frame must match parent's
[self.contentView addSubview: player.view];
[player play];
[player release];