我正在使用以下代码播放来自网址的视频但是当视频加载时只播放音频并且模拟器上没有显示视频..现在我无法在iphone 4.0上测试它设备......模拟器有问题还是 MPMoviePlayerViewController 不是正确的方法??
NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp";
NSURL *videoURL = [NSURL URLWithString:videoFilepath ];
MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playbackFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:movie];
[self presentMoviePlayerViewControllerAnimated:movie];
答案 0 :(得分:0)
试试这个
NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp";
NSURL *videoURL = [NSURL URLWithString:videoFilepath ];
MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playbackFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:[movie moviePlayer]];
[self presentMoviePlayerViewControllerAnimated:movie];
movie.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[movie.moviePlayer play];