MPMoviewPlayer计算视频播放期间的当前时间 [英] MPMoviewPlayer calculate current time during video play

查看:106
本文介绍了MPMoviewPlayer计算视频播放期间的当前时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想基于播放了多少视频来计算当前时间,我很困惑使用durationWatched的属性,请问有人可以帮助我该怎么办?或如何获取YouTube视频的当前时间?

i want to calculate current time based on how much video is played, i am confused to use the property of durationWatched, can any one help me what should i do? or how to get current time of youtube video?

推荐答案

我在MPMoviePlayerController上做了一个简单的类别

I have made a simple category on MPMoviePlayerController

您可以使用 currentTimeMonitor 方法获取当前播放时间:

You can get the current playback time using the currentTimeMonitor method:

[self.moviePlayerController currentTimeMonitor:^{
  NSLog(@"Current time %i",[moviePlayerController.lastRecordedPlaybackTime intValue]);            
}];

计时器每秒调用一次该块,以提供当前的播放时间.

A timer call the block every second to give you the current playbacktime.

在github上有一个存储库:

There is a repository on github:

https://github.com/AlbanPerli/MPMoviePlayerController-CurrentPlybackTimeMonitor

这篇关于MPMoviewPlayer计算视频播放期间的当前时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆