Playback speed during Audio Streaming in iOS using AVPlayer


I'm developing an iOS app using Swift and my problem is, trying to adjust the playback speed during audio streaming.

I am using AVPlayer for this project:

streamingPlayer = AVPlayer(playerItem: audioItem)

To adjust playback speed:

streamingPlayer.rate = slider.value

I tested it using a test server, and it works fine for normal links which help access audio files. There is no problem with the adjustment of playback speed and it works fine.

The problem occurs when the links involve more security. I can access the audio with a request through .ashx. The speed can be made slower (AVPlayer rate < 1) but the problem occurs when it has to be made faster. (Normal rate is 1, so problem is rate cannot be greater than 1)

I tried to use the function below, but it didn't help:


Another weird problem is that when testers tested it on high speed internet, it worked fine. I tested it on speeds between 15-30 mbps, and the problem still persists. I am assuming it is a problem with the connection to the server. I don't want users to use high speed internet to use the app. So can someone please help me optimize or solve this problem?

I have looked through the AVPlayer documentation and tried almost every functions provided.

Here is a sample link. Would appreciate if someone can help me out!

By : TestUser


I realize that this is coming in 9 months later but I had a similar problem to yours and figured it out so I thought I'd post for anybody looking at this in the future. You have to set: AVAudioPlayerName.enableRate = true.

By : FredLoh

This video can help you solving your question :)
By: admin