Get information about profile switch

When the media player switches its current profile to a new profile, you can retrieve information about the switch, including when it switched, width and height information, or why a different bit rate was used.

  1. Listen for the ProfileEvent.PROFILE_CHANGED event.

    The TVSDK media player dispatches this event when its adaptive bit rate switching algorithm switches to another profile because of network or machine conditions. (When the bit rate or the period changes.)

  2. When the event occurs, check the following properties for information about the switch:

    • profile: Identifier for the new profile being used.

    • time: The stream time at which the switch occurred.

    • description: Textual description of the reason for a bit rate change, as a string of semicolon-separated key/value pairs. Includes a maximum of one Reason and one Bitrate. If the information is not available or the bit rate did not change, this string is empty.

      Key name Possible values
      Reason
      • Network Adaptation
      • Seek
      • Profile Not Supported
      • Failover
      Bitrate
      • up : The bit rate increased
      • down : The bit rate decreased

      Here are some examples of returned description strings:

      "Bitrate::=up;Reason::=Network Adaptation;"
      
      "Bitrate::=down;Reason::=Failover;"
      
    • width: Integer indicating width in pixels.

    • height: Integer indicating height in pixels.

      NOTE

      Width and height data are only available when they are included in the RESOLUTION tag in the M3U8 manifest. If the information is not included in the M3U8, the width and height properties are set to 0, as they are not part of the profile information.

For example:

_player.addEventListener(ProfileEvent.PROFILE_CHANGED, onProfileChange);
private function onProfileChange(event:ProfileEvent):void {
    _logger.info("#onProfileChange Current profile/bitrate has changed.
      {0} for reason {1} of resolution [ {2} , {3} ]",
      event.profile, event.description, event.width, event.height);
}

On this page