MPMoviewPlayer计算视频播放期间的当前时间 [英] MPMoviewPlayer calculate current time during video play
问题描述
我想基于播放了多少视频来计算当前时间,我很困惑使用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屋!