這裏我想播放使用mediaplayer框架的youtube視頻。爲此我遵循這個過程, 1)我添加mediaplayer框架。 2)我導入的#import頭文件 3)我實現的代碼通過使用谷歌如何在ios中使用Mediaplayer框架播放視頻?
但它顯示線程,
任何一個可以告訴我怎麼解決這個問題。
這裏我想播放使用mediaplayer框架的youtube視頻。爲此我遵循這個過程, 1)我添加mediaplayer框架。 2)我導入的#import頭文件 3)我實現的代碼通過使用谷歌如何在ios中使用Mediaplayer框架播放視頻?
但它顯示線程,
任何一個可以告訴我怎麼解決這個問題。
請嘗試thie一個..我想這有人可能你的幫助。
- (IBAction)playVideo:(id)sender
{
NSURL *videosURL = [NSURL URLWithString:@"YourVideoURL"];
MPMoviePlayerController *moviePlayController = [[MPMoviePlayerController alloc]initWithContentURL:videosURL];
[self.view addSubview:moviePlayController.view];
[moviePlayController prepareToPlay];
moviePlayController.controlStyle = MPMovieControlStyleDefault;
moviePlayController.shouldAutoplay = YES;
[moviePlayController setFullscreen:YES animated:YES];
}
- (void) moviePlayBackDidFinish:(NSNotification*)notification
{
MPMoviePlayerController *player = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification object:player];
if ([player respondsToSelector:@selector(setFullscreen:animated:)])
{
[player.view removeFromSuperview];
}
}