在iOS AVPlayer中,似乎缺少addPeriodicTimeObserverForInterval [英] In iOS AVPlayer, addPeriodicTimeObserverForInterval seems to be missing

查看:107
本文介绍了在iOS AVPlayer中,似乎缺少addPeriodicTimeObserverForInterval的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置 AVPlayer.addPeriodicTimeObserverForInterval().有人成功使用了吗?

我正在使用Xcode 8.1,Swift 3

解决方案

选中此 func addPeriodicTimeObserver(forInterval interval:CMTime,队列:DispatchQueue ?,使用块:@转义(CMTime)->无效)->任何

例如在文档中也请检查此代码段

  let timeObserverToken = player.addPeriodicTimeObserver(forInterval:interval,queue:DispatchQueue.main){[unown self] time in} 

引用自此处

I'm trying to setup AVPlayer.addPeriodicTimeObserverForInterval(). Has anyone used this successfully?

I'm using Xcode 8.1, Swift 3

解决方案

Check this func addPeriodicTimeObserver(forInterval interval: CMTime, queue: DispatchQueue?, using block: @escaping (CMTime) -> Void) -> Any

It is in the documents also for example check this code snippet

let timeObserverToken = player.addPeriodicTimeObserver(forInterval: interval, queue: DispatchQueue.main) { [unowned self] time in 
}

Referenced from here

这篇关于在iOS AVPlayer中,似乎缺少addPeriodicTimeObserverForInterval的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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