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.
ABRInitialBitRate returns an integer value that represents the byte-per-second profile.
|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.
ABRMinBitRate returns an integer value that represents the bits-per-second profile.
|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.
ABRMaxBitRate returns an integer value that represents the bits-per-second profile.
|ABR switching policy|| Playback switches gradually to the highest-bit-rate profile when possible. You can set the policy for ABR switching, which determines how quickly TVSDK switches between profiles. The default is MODERATE_POLICY .
When TVSDK decides to switch to a higher bit rate, the player selects the ideal bit rate profile to switch to based on the current ABR policy:
If the initial bit rate is zero or is not specified, but a policy is specified, playback starts with the lowest bit rate profile for conservative, the profile closest to the median bit rate of available profiles for moderate, and the highest bit rate profile for aggressive.
The policy works in the constraints of the minimum and maximum bit rates, if these rates are specified.
ABRPolicy returns the current setting from the ABRControlParameters enum: CONSERVATIVE_POLICY, MODERATE_POLICY, or AGGRESSIVE_POLICY.
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 wi-fi to 3G or to various devices such as a phone, a tablet, or a desktop computer.
To set ABR control parameters, do one of the following:
ABRControlParameterBuilder helper class to set any subset of the parameters (operates on
ABRControlParameter behind the scenes)
Set the parameters on the
ABRControlParametersBuilder helper class is the simplest, most efficient way to set ABR parameters.
ABRControlParametersBuilder constructor sets all of the ABR parameters to default values on the underlying
You can reset individual ABR parameters during run time, as long as you maintain a reference to the same
This class also includes the
toABRControlParameters() helper method. Use this method to get an instance of
ABRControlParameters and set it on the
mediaPlayer.ABRControlParameters property. This causes your settings to go into effect in the player.
ABRControlParametersBuilder helper class, and set the parameters on the Media Player.
For example, the following sample initializes all parameters to the defaults, then sets only the policy to conservative, and restricts the maximum bit rate to 1000000:
var abrBuilder:ABRControlParametersBuilder = new ABRControlParametersBuilder(); abrBuilder.policy = ABRControlParameters.CONSERVATIVE_POLICY; abrBuilder.maxBitRate = 1000000; mediaPlayer.abrControlParameters = abrBuilder.toABRControlParameters();
Modify individual ABR parameters at run time.
To modify individual parameters while leaving the rest of the parameters as they were:
// If later you want to reset the max bit rate to 2000000 abrBuilder.maxBitRate = 2000000; mediaPlayer.abrControlParameters = abrBuilder.toABRControlParameters();
To retain your previous settings, you must maintain a reference to the same
ABRControlParametersBuilder instance you created in Step 1.
You can set ABR control values only with
ABRControlParameters, but you can construct a new one at any time.
This ability to set ABR parameters was supported before the existence of the
ABRControlParametersBuilder class, but this ability is still effective for setting ABR parameters at construction time. However, to change individual parameters after construction, you should use the
The following conditions apply to
Decide on initial, minimum, and maximum bit rates.
Determine the ABR policy:
Set the ABR parameter values in the
ABRControlParameters constructor and assign them to the Media Player.
mediaPlayer.abrControlParameters = new ABRControlParameters( ABRControlParameters.CONSERVATIVE_POLICY, 0, // Initial bit rate 0, // Minimum bit rate 1000000 // Maximum bit rate );