这是我在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秒 .
谢谢您的回答... :)
编辑:如何添加到我当前的时间...
CMTime currentTime = music.currentTime;
...... 5秒钟?
3 回答
使用AVPlayer方法
seekToTime
这是reference
希望能帮助到你
In Swift ,
In Objective-C,
您可以使用avPlayer.rate快进/快进
费率:1.0正常0.0暂停
但首先,您应该检查avPlayerItem是否可以执行您的操作之一
欲了解更多信息:https://developer.apple.com/LIBRARY/ios/documentation/AVFoundation/Reference/AVPlayer_Class/index.html#//apple_ref/occ/instp/AVPlayer/rate