I'm trying to change the playback bitrate while the video is playing dynamically on iOS AVFoundation.
In this stream: https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8, there are 5 video bitrates and now the AV chooses the bitrate automatically.
I want to allow the user to select HD quality, so I need a way to force the player to choose the highest bitrate without replacing the source.
The Apple's documentation for [AVPlayerItem]
(see docs) has the preferredPeakBitRate:
method described as:
The desired limit, in bits per second, of network bandwidth consumption for this item.
If network bandwidth consumption cannot be lowered to meet the preferredPeakBitRate, it will be reduced as much as possible while continuing to play the item.
AVPlayerItem: Configuring Network Behaviour [online]. [cit. 2017-02-14]. Available from: https://developer.apple.com/reference/avfoundation/avplayeritem
It isn't hard-limit per say, but if the connection can support the bitrate (as deemed by the iOS) then it tries to meet the expectations.
As for the list of available bitrates you would need to manually parse the m3u8
file or just create the levels yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With