user7172547
user7172547

Reputation:

how to change the playing speed of AVPlayerItem in swift?

I am using a library named Jukebox , to play audios files , I want to make it player faster or slower. It inherits AVPlayerItem , but I can't find how. Any one can help me?

Upvotes: 2

Views: 1026

Answers (1)

Hussain Shabbir
Hussain Shabbir

Reputation: 14995

I think you can use the AVPlayer rate property below

var rate: Float { get set }

For instance:-

if let playerItem = AVPlayerItem(URL: yourUrl), let player = AVPlayer(playerItem: playerItem) {
//This will update your player speed faster or slower accordingly
  player.rate = Float(rateValue)
}

Upvotes: 2

Related Questions