2
我播放了電影,但無法在電影完成時調用該方法。電影播放器沒有完成通知在iOS SDK中沒有觸發
我的代碼如下:
MPMoviePlayerViewController *pv=[[MPMoviePlayerViewController alloc]initWithContentURL:[NSURL fileURLWithPath:[[arr_videos objectAtIndex:indexPath.row]valueForKey:@"Video_path"]]];
MPMoviePlayerController *pc=[pv moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:pv];
[self presentViewController:pv animated:YES completion:nil];
[pc prepareToPlay];
[pc play];
感謝您的回覆...... !!但它只顯示黑屏和視頻未播放 – user2526811
[theMovie play]需要用來播放它。 –
是的,已經試過這個,但得到了同樣的結果。如果我使用'MoviePlayerViewController',那麼它運行良好,但委託方法不會被調用。 – user2526811