Quality Events

These API calls are used to listen to or update the video quality if multiple quality levels of a video are provided. Quality levels are sorted and given index numbers.

πŸ“˜

An index of 0 will always be "Auto".



.on('levels')

Fired when the list of available quality levels is updated. Happens e.g. shortly after a playlist item starts playing.

Returns an object with the following:

ValueDescriptionType
widthThe new width of the playerNumber
levelsThe full array of qualities, including the new additions. Includes the same information as getQualityLevels()Array


.on('levelsChanged')

Fired when the active quality level is changed. Happens in response to e.g. a user clicking an option in the quality menu or a script calling setCurrentQuality.

Returns an object with the following:

ValueDescriptionType
currentQualityindex of the new quality level in the getQualityLevels() arrayNumber


.on('visualQuality')

Fires when the active quality level is changed for HLS

This is different than levelsChanged since this will trigger when adaptive streaming automatically shifts quality.

{
    "reason": "initial choice",
    "mode": "auto",
    "level": {
        "bitrate": 700000,
        "index": 1,
        "label": "auto",
        "width": 1280,
        "height": 536
    },
    "type": "visualQuality"
}
Property Description
level object Information for wach quality of a media item

See: level
mode string Current type of quality selection

Possible Values:
  • auto: Automatic quality switching
  • manual: Static quality
reason string Explanation for the quality change

Possible Values:
  • api: The user chose a static quality after playback commenced or an API set the quality.
  • auto: An automatic quality change occurred.
  • initial choice: The user had this quality set as a default and did not change it.
type string Category of the event

This is always visualQuality for this event.

level

Property Description
bitrate string Bitrate of the media file
height number Height of the media file
index number Index of the quality level
label string Label of the quality level
width number Width of the media file

© 2007-2024 Longtail Ad Solutions, Inc.