KRVideoPlayer 优化视频播放

作者: 小兵快跑 | 来源:发表于2017-06-19 23:01 被阅读474次

    在"KRVideoPlayer"基础上加以优化,集成视频播放功能

    Demo video 播放分两种情况:
    
    1.加载到当前 view 上使用简单,不便于控制,实际运用有好多 Bug
    [self addSubview:self.videoController.view]
    
    2.video 显示在 window 便于控制
    [self.videoController showInWindow]
    

    KRVideoPlayer 播放集成

       
            NSString *path = [[NSBundle mainBundle]pathForResource:@"150511_JiveBike.mov" ofType:nil];
            NSURL *url = [NSURL fileURLWithPath:path];
            
            self.videoController = [[KrVideoPlayerController alloc] initWithFrame:CGRectMake(0,0,Width,200)];
            __weak typeof(self)weakSelf = self;
            self.videoController.view.backgroundColor = [UIColor whiteColor];
            [self.videoController setDimissCompleteBlock:^{
                weakSelf.videoController = nil;
            }];
            [self.videoController setWillBackOrientationPortrait:^{
                        [weakSelf toolbarHidden:NO];
            }];
            [self.videoController setWillChangeToFullscreenMode:^{
                        [weakSelf toolbarHidden:YES];
            }];
    //        [self addSubview:self.videoController.view];  加载到当前 view 上使用简单
            [self.videoController showInWindow]; //video 显示在 window 便于控制
            
            self.videoController.contentURL = url;
            
    
    video.gif

    QRGVideo Demo 在真机上运行体验更好

    相关文章

      网友评论

      • 天蝎座沫沫:你好,在使用中是否遇到过报错An AVPlayerItem cannot be associated with more than one instance of AVPlayer

      本文标题:KRVideoPlayer 优化视频播放

      本文链接:https://www.haomeiwen.com/subject/tzinqxtx.html