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"
}
PropertyDescription
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

PropertyDescription
bitrate stringBitrate of the media file
height numberHeight of the media file
index numberIndex of the quality level
label stringLabel of the quality level
width numberWidth of the media file

© 2007- Longtail Ad Solutions, Inc.