简体   繁体   English

使用AVPlayer进行敏感的电影擦洗

[英]Sensitive movie scrubbing with AVPlayer

I'm building a movie player which requires a highly sensitive scrubbing feature. 我正在构建一个需要高度敏感的擦洗功能的电影播放器​​。 My aim is to allow the user to scrub frame by frame if he selects the highest sensitivity. 我的目的是让用户在选择最高灵敏度时逐帧扫描。

Currently I'm using the method: 目前我正在使用该方法:

[player seekToTime:CMTimeMakeWithSeconds(duration*(Float64) slider.value, 600)];

but I'm far from the sensitivity I wish to achieve. 但我远没有达到我希望达到的敏感度。 Can someone advice or point out better method or even frameworks to get this feature done. 有人可以建议或指出更好的方法甚至框架来完成此功能。

Thanks in advance. 提前致谢。

Solve this problem. 解决这个问题。 Somehow it slipped from my eyes but there is a method that does exactly that: 不知怎的,它从我的眼睛里滑落但是有一种方法可以做到这一点:

[player seekToTime:CMTimeMakeWithSeconds(duration*(Float64)value  , 600) 
      toleranceBefore:kCMTimeZero 
       toleranceAfter:kCMTimeZero];

The toleranceBefore and the toleranceAfter are set to zero which means it will get exactly to the point you are searching but it will take more time to decode the frame. toleranceBeforetoleranceAfter被设置为零,这意味着它将精确到达您正在搜索的点,但解码帧将花费更多时间。

Just want to mention a limitation of HLS here. 只想在这里提到HLS的限制。 Even though you specify the tolerance 0, it is not possible to seek in the middle of any ts segment. 即使您指定公差0,也无法在任何ts段的中间进行搜索。 Once you lift your finger from scrubber to seek a position, the player will start playing the video from the nearest TS segment. 将手指从擦洗器上抬起以寻找位置后,播放器将开始播放距离最近的TS段的视频。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM