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 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:

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

Mobile SDK

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

iOS (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 (Kotlin)

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

Roku (BrightScript)

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

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:

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

Media SDK

Update the QoE object and fire the event:

var qoeObject = ADB.Media.createQoEObject(4500, 0, 24, 0);
tracker.updateQoEObject(qoeObject);
tracker.trackEvent(ADB.Media.Event.BitrateChange);

Media Collection API

Send a bitrateChange POST request with the new bitrate:

{
  "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