iOS 5.1,这里是代码:
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL URLWithString:@"map.mp4"]]; [player prepareToPlay]; [player.view setFrame: self.view.bounds]; // player's frame must match parent's [self.view addSubview: player.view]; // ... [player play];
其实这跟苹果的引用说的是一样的,但是当我点击按钮来使用这个功能时,只有一个黑色的矩形留在那里,没有vedio播放,没有声音发生,没有粉碎,所以我想知道如何使这项工作
解决方法
很抱歉很晚回复.解决方案是一种很好的选择.但是它帮助我在面对同一个问题的同时继续前进.
MPMovieSourceTypeStreaming是你错过的事情.
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL URLWithString:@"map.mp4"]]; [player prepareToPlay]; [player.view setFrame: self.view.bounds]; // player's frame must match parent's player.movieSourceType = MPMovieSourceTypeStreaming; [self.view addSubview: player.view]; // ... [player play];