开发者

MPMoviePlayerViewController playing only audio no video on simulator?

i am using the following code to play a video from a url but when the video loads only audio is played and no video is shown on simulator..right now i cant test it on iphone 4.0 device...is there a problem with the simulator or is MPMoviePlayerViewController is not the right way??

NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3开发者_如何学运维gp";
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];


try this

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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜