更新UISlider值视频播放器

时间:2015-08-19 08:45:27

标签: ios objective-c avfoundation vimeo-api

我正在使用VIMVideoPlayer播放视频,我正在尝试更新UISlider的值,以便它反映播放器的当前时间。但是,这根本不会更新该值。

UISlider的最小值为0,最大值为1,当前值为0.

委托方法是:

-(void) videoPlayerView:(VIMVideoPlayerView *)videoPlayerView didFailWithError:(NSError *)error {

}

-(void) videoPlayerViewDidReachEnd:(VIMVideoPlayerView *)videoPlayerView {
    [self.playerSlider setValue:0.0 animated:YES];
}

-(void) videoPlayerViewIsReadyToPlayVideo:(VIMVideoPlayerView *)videoPlayerView {

}
- (void)videoPlayerView:(VIMVideoPlayerView *)videoPlayerView timeDidChange:(CMTime)cmTime {

    float time = CMTimeGetSeconds(videoPlayerView.player.player.currentTime);
    float dur = CMTimeGetSeconds(videoPlayerView.player.player.currentItem.duration);
    float progress = time/dur;
    NSLog(@"here : %f", progress);
    if (progress > 0.0) {
        [self.playerSlider setValue:progress animated:YES];
    }

}

- (void)videoPlayerView:(VIMVideoPlayerView *)videoPlayerView loadedTimeRangeDidChange:(float)duration {

}

0 个答案:

没有答案