lionheart / openradar-mirror

A mirror of radars pulled from http://openradar.me/.
244 stars 17 forks source link

15804894: Setting property 'rate' of AVPlayer does not work for all values between 0 and 1. #3980

Open openradar-mirror opened 9 years ago

openradar-mirror commented 9 years ago

Description

Summary: When setting the rate of an AVPlayer instance, the playback rate is always rounded to predefined values (e.g. 0.5, 0.67, 0.8, 1.0). For example, 0.1 playback speed is not possible. However, larger rates are supported. The playbackRate can be set to 1000x without problems.

Steps to Reproduce: 1.) Setup AVPlayer with AVPlayerItem. 2.) Setup AVPlayerLayer 3.) Set player.rate = 0.1f;

Expected Results: Playing speed at 0.1

Actual Results: Playing speed at 0.5

Version: iOS 7.0

Product Version: 7.0 Created: 2014-01-13T17:27:53.005063 Originated: 2014-01-13T00:00:00 Open Radar Link: http://www.openradar.me/15804894

s4nj33b commented 4 years ago

Actually it depends on the processing algorithm in use of managing audio pitch. So that you need to set proper algorithm for audio pitch on you AVPlayerItem.

let player = AVPlayer(url: videoFileURL) player.currentItem?.audioTimePitchAlgorithm = .varispeed player.rate = 0.1

Hope this helps. Thanks!