I am working on video player app which streams video from m3u8 url. Due to apple limitation, I can't set specific video quality during playtime or startup. I am curious because i can see this feature supported in Youtube iOS app. Apple provides preferredPeakBitRate but it doesn't guarantee whether video will be played in that bitrate.
How do youtube able to achieve that video quality or maintaining specific video quality in iOS? Just let me know if i am doing anything wrong or missing anything. Thanks in advance
CodePudding user response:
Check my following SO answer that answers similar question. Hopefully it suits your needs
CodePudding user response:
Try this
if let lastEvent = self.playerItem?.accessLog()?.events.last {
let selectedBitRate = lastEvent.indicatedAverageBitrate
selectedAverageBitRate = selectedBitRate
selectedIndex = variants.firstIndex(where: {$0.averageBitRate ?? 0 == selectedBitRate})
}