Media downloaded flag

This page covers data collection for the Media downloaded flag variable. See Media downloaded for the corresponding reporting dimension.

The media downloaded flag indicates that a session is playback of previously downloaded offline content rather than a live stream from the internet. Set it when initializing the tracker (Mobile SDK) or include it in the sessionStart payload (Edge / Media Collection API). Use this flag to separate offline playback from streamed sessions in reporting.

Property
Value
Context data variable
a.media.downloaded
XDM collection field
xdm.mediaCollection.sessionDetails.isDownloaded
Audience Manager trait
c_contextdata.a.media.downloaded
Required
No
Sent with
Session start, session close
Web SDK

Set isDownloaded to true inside xdm.mediaCollection.sessionDetails when calling sendEvent:

code language-javascript
alloy("sendEvent", {
  xdm: {
    eventType: "media.sessionStart",
    mediaCollection: {
      sessionDetails: {
        name: "video-123",
        length: 128,
        contentType: "vod",
        playerName: "HTML5 Player",
        channel: "Sports",
        streamType: "video",
        isDownloaded: true
      },
      playhead: 0
    }
  }
});
iOS

Set the downloaded-content flag on the tracker config when creating the tracker, using MediaConstants.TrackerConfig.DOWNLOADED_CONTENT.

code language-swift
var config: [String: Any] = [:]
config[MediaConstants.TrackerConfig.PLAYER_NAME] = "HTML5 Player"
config[MediaConstants.TrackerConfig.CHANNEL] = "Sports"
config[MediaConstants.TrackerConfig.DOWNLOADED_CONTENT] = true

Media.createTrackerWith(config: config) { tracker in
    self.tracker = tracker
}
Android

Set the downloaded-content flag on the tracker config when creating the tracker, using MediaConstants.TrackerConfig.DOWNLOADED_CONTENT.

code language-kotlin
val config = HashMap<String, Any>()
config[MediaConstants.TrackerConfig.PLAYER_NAME] = "HTML5 Player"
config[MediaConstants.TrackerConfig.CHANNEL] = "Sports"
config[MediaConstants.TrackerConfig.DOWNLOADED_CONTENT] = true

val tracker = Media.createTracker(config)
Roku Edge

Set isDownloaded to true inside xdm.mediaCollection.sessionDetails when calling createMediaSession:

code language-brightscript
m.aepSdk.createMediaSession({
    "xdm": {
        "eventType": "media.sessionStart",
        "mediaCollection": {
            "sessionDetails": {
                "name": "video-123",
                "length": 128,
                "contentType": "vod",
                "playerName": "Roku Player",
                "channel": "Sports",
                "streamType": "video",
                "isDownloaded": true
            },
            "playhead": 0
        }
    }
})
Media Edge API

Call the downloaded endpoint after the device returns online, batching the full offline session inside mediaDownloadedEvents. Adobe automatically sets isDownloaded to true and assigns a session ID; do not include either in the payload.

code language-json
{
  "events": [{
    "xdm": {
      "eventType": "media.downloaded",
      "mediaDownloadedEvents": [
        {
          "mediaEventTimestamp": "YYYY-09-26T15:52:24+00:00",
          "mediaEventType": "media.sessionStart",
          "mediaCollection": {
            "sessionDetails": {
              "name": "video-123",
              "length": 128,
              "contentType": "vod",
              "playerName": "HTML5 Player",
              "channel": "Sports"
            },
            "playhead": 0
          }
        },
        {
          "mediaEventTimestamp": "YYYY-09-26T15:54:32+00:00",
          "mediaEventType": "media.sessionComplete",
          "mediaCollection": {
            "playhead": 128
          }
        }
      ]
    }
  }]
}

Legacy implementation types (Analytics-only)

Media SDK JS 3.x

Set downloadedContent on ADB.MediaConfig before creating the tracker:

code language-javascript
var mediaConfig = new ADB.MediaConfig();
mediaConfig.trackingServer = "your.tracking.server";
mediaConfig.playerName = "HTML5 Player";
mediaConfig.channel = "Sports";
mediaConfig.downloadedContent = true;

var tracker = ADB.Media.getInstance(mediaConfig);
Chromecast

Set MediaDownloaded on the media info object before calling trackSessionStart:

code language-javascript
var mediaInfo = ADBMobile.media.createMediaObject("My Video", "video-123", 128,
  ADBMobile.media.StreamType.VOD, ADBMobile.media.MediaType.Video);
mediaInfo[ADBMobile.media.MediaObjectKey.MediaDownloaded] = true;
ADBMobile.media.trackSessionStart(mediaInfo, null);
Roku 2.x
Downloaded content tracking is not available in the Roku 2.x SDK. To report downloaded media playback, use the Roku Edge SDK or the Media Collection API.
Media Collection API

Include media.downloaded in the params object of your sessionStart POST request:

code language-json
{
  "playerTime": { "playhead": 0, "ts": 1699523820000 },
  "eventType": "sessionStart",
  "params": {
    "media.downloaded": true
  }
}

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

recommendation-more-help
media-analytics-help