ios - 如何在 ios 中使用 Mediaplayer 框架播放视频?

标签 ios video media-player

这里我想使用 mediaplayer 框架播放 youtube 视频。为此我遵循这个过程, 1)我正在添加媒体播放器框架。 2)我正在导入#import 头文件 3)我使用google实现了代码

但是它显示线程,

谁能告诉我如何解决这个问题。

最佳答案

请试试这个……我想这个可能对你有帮助。

- (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];
    }
}

关于ios - 如何在 ios 中使用 Mediaplayer 框架播放视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15196559/

相关文章:

ios - 多点连接框架 : Stability and Recommendations

html - 动画 css 进度条而不在更新之间跳转?

video - 自动视频创建 API

android - 在 Android 上播放加密文件

ios - 我的 tableViewCells 没有创建?

iphone - 在 Xcode 上播放音频 (mp3) 的问题

android - 线程和媒体播放器问题,带声音的计时器

Android SDK - 如何一次停止所有媒体播放器

ios - Xcode 5.1 无法找到实用程序 "make",不是开发人员工具或在 PATH 中

objective-c - 如何在 Objective C/Cocoa 中获取 quicktime 视频的编解码器信息? (没有 FFMPEG)