0
我在iphone通過使用此代碼的電影播放器打開1秒鐘,然後自動關閉,沒有播放文件播放的視頻通過使用此代碼如何在iPhone SDK 4.0中播放視頻?
-(IBAction)btnNew_clicked:(id)sender {
NSURL *url = [NSURL URLWithString:@"http://www.businessfactors.de/bfcms/images/stories/videos/defaultscreenvideos.mp4"];
MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[[mp moviePlayer] prepareToPlay];
[[mp moviePlayer] setShouldAutoplay:YES];
[[mp moviePlayer] setControlStyle:2];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[self presentMoviePlayerViewControllerAnimated:mp];}
-(void)videoPlayBackDidFinish:(NSNotification*)notification {
[self dismissMoviePlayerViewControllerAnimated]; }
。
我檢查了視頻文件是正確的,但它不是在iphone SDK 4.0中播放。
在此先感謝。
這個職位顯示如何在WebView中播放視頻文件我的問題是改變。請提供足夠的建議。 – Apekshit 2011-02-25 06:06:36
@安德森 - 它在我的測試項目中工作,嘗試更新的答案! – 2011-02-25 06:29:07
您的代碼在我的設備中無法使用。你能不能把你的測試項目以zip格式發給我,所以我可以在我的設備上測試它。目前我正在使用ios 4.0上的iphone 3gs。感謝您提供建議。 – Apekshit 2011-02-25 07:01:35