AVPlayer-快速前进/后退流 [英] AVPlayer - Fast Backward / Forward Stream
本文介绍了AVPlayer-快速前进/后退流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我在viewDidLoad中的代码:
This is my code in the viewDidLoad :
AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://groove.wavestreamer.com:7321/listen.pls?sid=1"]];
[playerItem addObserver:self forKeyPath:@"timedMetadata" options:NSKeyValueObservingOptionNew context:nil];
music = [[AVPlayer playerWithPlayerItem:playerItem] retain];
[music play];
我的问题:
我如何创建一个按钮,当按下该按钮时,它会在视频流中快进/快退5秒钟?
My question:
How can I create a button, that fast-forwards / fast-backwards the stream 5 seconds, when it´s pressed?
谢谢您的回答...:)
Thank you for your answers... :)
如何添加到我的当前时间...
How can I add to my current time...
CMTime currentTime = music.currentTime;
... 5秒?
推荐答案
使用AVPlayer方法seekToTime
Use AVPlayer method seekToTime
AVPlayer *player=..;
[player seekToTime:time toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero];
这是参考
希望有帮助
这篇关于AVPlayer-快速前进/后退流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文