HLS and DASH streams provide different bit rate encodings (profiles) for the same short burst of video. TVSDK can select the quality level for each burst based on the available bandwidth.
TVSDK constantly monitors the bit rate to ensure that the content is played at the optimal bit rate for the current network connection.
You can set the adaptive bit-rate (ABR) switching policy and the initial, minimum, and maximum bit rates for a multiple-bit-rate (MBR) stream. TVSDK automatically switches to the bit rate that provides the best playback experience in the specified configuration.
Initial bit rate | The desired playback bit rate (in bits per second) for the first segment. When playback starts, the closest profile, which is equal to or greater than the initial bit rate, is used for the first segment. If a minimum bit rate is defined, and the initial bit rate is lower than the minimum rate, TVSDK selects the profile with the lowest bit rate above the minimum bit rate. If the initial rate is above the maximum rate, TVSDK selects the highest rate below the maximum rate. If the initial bit rate is zero or undefined, the initial bit rate is determined by the ABR policy. |
Minimum bit rate | The lowest allowed bit rate to which the ABR can switch. ABR switching ignores profiles with a bit rate that is lower than this bit rate. |
Maximum bit rate | The highest allowed bit rate to which the ABR can switch. ABR switching ignores profiles with a bit rate higher than this bit rate. |
Keep the following information in mind:
For example, if a stream has the following profiles:
If you specify a range of 300000 to 2000000, TVSDK considers only profiles 1, 2 and 3. This allows applications to adjust to various network conditions, such as switching from WiFi to 3G or to various devices such as a phone, a tablet, or a desktop computer.
To configure TVSDK adaptive bit-rate parameters:
Configure an instance of PTABRControlParameters
to set the initial, minimum, and maximum bit-rate settings.
The default values are displayed in the following code snippet, but your application can set any integer value for each of these parameters.
Specify the bit-rate settings in bits-per-second (bps).
// ARC (add autorelease for non-ARC)
PTABRControlParameters *abrMetaData =
[[PTABRControlParameters alloc] init];
abrMetaData.initialBitRate = -1;
abrMetaData.minBitRate = 0;
abrMetaData.maxBitRate = INT_MAX;
Update your PTMediaPlayer
instance with the configured PTABRControlParameters
instance.
// assuming self.player is the PTMediaPlayer instance
self.player.abrControlParameters = abrMetaData;
Remember the following:
The application must set the abrControlParameters
property on PTMediaPlayer
before configuring a PTMediaPlayerItem
instance for the initial and minimum bitrate settings to take effect.
After content playback starts, setting a new instance only affects the maximum bitrate setting.
To update the maximum bitrate setting during playback, create a new PTABRControlParameters
instance and set it on the player instance.
You can update the maximum bitrate setting during playback only on iOS 8.0 and later. For earlier versions, the maxBitrate
value that was set before content playback started is used.