Media Edge API implementation examples

This page provides two examples on how you can structure your API calls to successfully collect a media tracking session.

An API call is made for each action that you want to track. Once the media session ends, all API calls are recompiled into events that Adobe Experience Platform can ingest into a dataset. Expect to send many Media Edge API calls that end up as a smaller number of rows within a dataset. On average, approximately 6 API calls are used per event recorded in a dataset.

Some helpful tips to keep in mind regarding these examples:

Prerequisites

Before following these examples, make sure that you have an API environment set up based on the steps outlined on the Getting started overview page, specifically:

Example 1: Buffer state and a pause

This example contains the following elements:

The following actions and playhead diagrams show the differences in time during a buffer and a pause:

The following table shows a timeline of actions to be tracked for this example. Each row summarizes the action and the request endpoint. Each action is described in more detail with payloads below the table. The Client Request column shows the final path parameter and other parameters required to include in the call.

Number
Action
Elapsed Real-Time (from beginning)
Playhead Position
Client Request
1
The auto-play function occurs, or the play button is pressed, and the video starts loading
0
0
/sessionStart?configId=<datastreamID>
2
The ping event timer starts
0
0
/ping?configId=<datastreamID>
3
Tracks the buffer start
1
1
/bufferStart?configId=<datastreamID>
4
Tracks the end of the buffer and a play event is sent
4
1
/play?configId=<datastreamID>
5
Sends a ping
10
7
/ping?configId=<datastreamID>
6
User presses pause
15
12
/pauseStart?configId=<datastreamID>
7
Sends a ping
20
12
/ping?configId=<datastreamID>
8
User presses play to resume the main content
24
12
/play?configId=<datastreamID>
9
User closes the app without watching the content to the end
29
17
/sessionEnd?configId=<datastreamID>

Each timeline action shown in the previous table is described in detail below. Each description includes the payload that is sent as part of a Media Edge API request.

Example 2: Two chapters separated by an ad break

This section provides an example tracking a media session with the Media Edge API service. The example session shown for this use case contains the following elements:

The following action and playhead diagrams show the differences in time during an ad break.

The following diagram shows a timeline of actions for this example session. Each number (1-18) represents an action and its request endpoint. These numbers also correspond to event descriptions in both the Timeline summary table and the Detailed descriptions section below.

Action timeline

The Client request column in the table below shows the final path parameter and the other parameters required to include in the call.

Number
Action
Elapsed Real-Time (from beginning in seconds)
Playhead Position (in seconds)
Client request
1
The auto-play function occurs, or the Play button is pressed, and the video starts loading.
0
0
/sessionStart?configId=<datastreamID>
2
The ping event timer starts
0
0
/ping?configId=<datastreamID>
3
Tracks the play event
0
0
/play?configId=<datastreamID>
4
Tracks the start of Chapter 1
1
1
/chapterStart?configId=<datastreamID>
5
Sends a ping
10
10
/ping?configId=<datastreamID>
6
Tracks the completion of Chapter 1
15
15
/chapterComplete?configId=<datastreamID>
7
Tracks the start of ad break
15
15
/adBreakStart?configId=<datastreamID>
8
Tracks the start of Ad 1 in ad break
15
15
/adStart?configId=<datastreamID>
9
Sends a ping twice during Ad 1, each 10 seconds apart
20, 30
15, 15
/ping?configId=<datastreamID>
10
Tracks completion of Ad 1
31
15
/adComplete?configId=<datastreamID>
11
Tracks the start of Ad 2 in ad break
31
15
/adStart?configId=<datastreamID>
12
Sends ping
40
15
/ping?configId=<datastreamID>
13
Tracks completion of Ad 2
43
15
/adComplete?configId=<datastreamID>
14
Tracks completion of ad break
43
15
/adBreakComplete?configId=<datastreamID>
15
Tracks the start of Chapter 2
43
15
/chapterStart?configId=<datastreamID>
16
Sends ping
50
22
/ping?configId=<datastreamID>
17
Tracks completion of Chapter 2
54
26
/chapterComplete?configId=<datastreamID>
18
Tracks completion of session when user finishes watching the content to the end
55
26
/sessionComplete?configId=<datastreamID>

Each timeline action shown in the previous table is described in detail below. Each description includes the payload that is sent as part of a Media Edge API request.

See Media Edge API overview for a full list of endpoints that you can use to build a media tracking session.