Wenfengcheng / xamarin-notes

xamarin journal
MIT License
3 stars 0 forks source link

Switch AVPlayer(Item) streaming bitrate quality #4

Open Wenfengcheng opened 6 years ago

Wenfengcheng commented 6 years ago

preferredPeakBitRate

SDKs iOS 8.0+ macOS 10.10+ tvOS 9.0+

The desired limit, in bits per second, of network bandwidth consumption for this item.

Declaration

var preferredPeakBitRate: Double { get set } Discussion

Set preferredPeakBitRate to non-zero to indicate that the player should attempt to limit item playback to that bit rate, expressed in bits per second.

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.`

References:

https://developer.apple.com/documentation/avfoundation/avplayeritem/1388541-preferredpeakbitrate https://forums.developer.apple.com/thread/75994

Wenfengcheng commented 6 years ago

just need to set preferredPeakBitRate directly to the current AVPlayerItem instance, then the player will take care of handling the peak bitrate automatically. Don't need to create new and replace anything.