Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to select the bit rate while using AVPlayer for HTTP live audio streaming?

I'm using AVPlayer to stream audio content delivered in two quality formats.

The problem is that when passing from a lower format to a higher one ( done automatically by the framework when wi-fi is available ) there is a delay while playing.

Is there a way to manually select a desired quality in order to prevent that delay?

like image 712
Spiri Avatar asked Mar 16 '11 15:03

Spiri


2 Answers

It's possible now in iOS8.

Checkout preferredPeakBitRate on AVPlayerItem.

Following copied from Apple's documentation:

The desired limit, in bits per second, of network bandwidth consumption for this item.
SWIFT: var preferredPeakBitRate: Double
OBJECTIVE-C: @property(nonatomic) double preferredPeakBitRate

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.

like image 143
Nuclear Hazard Avatar answered Oct 13 '22 19:10

Nuclear Hazard


Use Pantomime, is a lightweight framework for iOS, OSX and tvOS that can read and parse HTTP Live Streaming manifests. Pantomime

like image 44
Lijith Vipin Avatar answered Oct 13 '22 19:10

Lijith Vipin