KRVideoPlayer 优化视频播放

在"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 在真机上运行体验更好

推荐阅读更多精彩内容