Bitrate change

This page covers how to implement bitrate-change events. See Bitrate changes (dimension) and Bitrate changes (metric) for the corresponding reporting variables.

The bitrate change event signals that the player has switched to a different bitrate. Update the Bitrate value on the QoE object first, then fire the bitrate change event. The backend uses the count of these events to compute the Bitrate changes dimension and Bitrate changes metric, and the resulting bitrate values feed Average bitrate.

Property
Value
Context data variable
(none — counted by the backend)
XDM event type
media.bitrateChange
Audience Manager trait
c_contextdata.a.media.qoe.bitrateChangeCount
Required
No
Sent with
Bitrate change
Web SDK

Use sendEvent to send a media.bitrateChange event with the new bitrate:

code language-javascript
alloy("sendEvent", {
  xdm: {
    eventType: "media.bitrateChange",
    mediaCollection: {
      qoeDataDetails: {
        bitrate: 4500,
        droppedFrames: 0,
        framesPerSecond: 24,
        timeToStart: 0
      },
      sessionID: "{sid}",
      playhead: 120
    }
  }
});
iOS

Update the QoE object with the new bitrate, then fire the bitrate change event.

code language-swift
let qoeObject = Media.createQoEObjectWith(bitrate: 4500,
                                       startupTime: 0,
                                               fps: 24,
                                     droppedFrames: 0)
tracker.updateQoEObject(qoe: qoeObject)
tracker.trackEvent(event: MediaEvent.BitrateChange, info: nil, metadata: nil)
Android

Update the QoE object with the new bitrate, then fire the bitrate change event.

code language-kotlin
val qoeObject = Media.createQoEObject(4500L, 0.0, 24.0, 0L)
tracker.updateQoEObject(qoeObject)
tracker.trackEvent(Media.Event.BitrateChange, null, null)
Roku

Use sendMediaEvent with media.bitrateChange to signal a bitrate change. Include the new bitrate in qoeDataDetails:

code language-brightscript
m.aepSdk.sendMediaEvent({
    "xdm": {
        "eventType": "media.bitrateChange",
        "mediaCollection": {
            "qoeDataDetails": {
                "bitrate": 4500,
                "droppedFrames": 0,
                "framesPerSecond": 24,
                "timeToStart": 0
            },
            "playhead": 120
        }
    }
})
Media Edge API

Call the bitrateChange endpoint with the updated qoeDataDetails:

code language-json
{
  "events": [{
    "xdm": {
      "eventType": "media.bitrateChange",
      "mediaCollection": {
        "qoeDataDetails": {
          "bitrate": 4500
        },
        "sessionID": "{sid}",
        "playhead": 120
      }
    }
  }]
}

Legacy implementation types (Analytics-only)

Media SDK JS 3.x

Update the QoE object and fire the event:

code language-javascript
var qoeObject = ADB.Media.createQoEObject(4500, 0, 24, 0);
tracker.updateQoEObject(qoeObject);
tracker.trackEvent(ADB.Media.Event.BitrateChange);
Chromecast

Update the QoS object with the new bitrate, then fire the bitrate change event:

code language-javascript
var qosInfo = ADBMobile.media.createQoSObject(
  4500,  // bitrate (kbps)
  0,     // startupTime
  24,    // fps
  0      // droppedFrames
);
ADBMobile.media.updateQoSObject(qosInfo);
ADBMobile.media.trackEvent(ADBMobile.media.Event.BitrateChange);
Media Collection API

Send a bitrateChange POST request with the new bitrate:

code language-json
{
  "playerTime": { "playhead": 120, "ts": 1699523820000 },
  "eventType": "bitrateChange",
  "params": {
    "media.qoe.bitrate": 4500
  }
}

See the Media Collection API events reference for the full request structure.

recommendation-more-help
media-analytics-help