Every user stream is given a session ID, which is saved for 48 hours after an event. Monitored sessions are saved for 60 days. You can enter the session ID into the "Sessions identifier" field of the stream activity monitor (SAM). The search results allow you to see details about the user ad requests to troubleshoot a video stream.
We'll cover the following ways to find a sessions ID:
- Find a session ID in an app that uses the IMA SDK
- Find a session ID when you inspect HTTP traffic
- Find a session ID from an emulated HTTP request
- Find a session ID in an SSB stream request
Use a debug key to view activity or troubleshoot a video stream (Beta)
Alternately, you can use a debug key to see activity or troubleshoot a video stream.
You can set or pass a unique key for any stream or session to be able to debug the stream using SAM. If you use the same key across sessions, only the most recent session is searchable and available to debug.
- Streams requested with the IMA SDK: refer to the SDK documentation for API call to set the key.
- Streams requested without IMA SDK (SSB): pass a debug key using the
dai-sam-id
parameter.For example:
https://dai.google.com/linear/hls/event/.../master.m3u8?dai-sam-id=abcdef-0a1b-12a3
Keys cannot contain any personally-identifiable information.
Find a session ID in an app that uses the IMA SDK
When you use the IMA SDK to create a video stream, you can call a method to obtain the session ID. See details about how to obtain the ID on each platform’s SDK:
Many application developers choose to capture the session ID and log it so that it’s available for stream troubleshooting.
Because the session ID is essential to review details about ad delivery in a user’s stream, it's helpful to implement a method or hidden feature in your application to easily display the ID.
Find a session ID when you inspect HTTP traffic
You can monitor HTTP requests in a proxy tool from an application that uses the IMA SDK.
When you use the IMA SDK to request a Dynamic Ad Insertion (DAI) video stream, there are two HTTP requests:
- The HTTP
POST
, which should return with a 201 status, indicating that a new stream has been created. - The HTTP
GET
request to the URL in thestream_manifest
field. *
Additional information is returned in a JSON structure, including the stream_id
. This is the session ID you should enter into the "Sessions identifier" field.
Find a session ID from an emulated HTTP request
You can emulate an SDK HTTP request sequence using curl
from a command-line prompt, with the content ID and video ID from a video-on-demand stream URL.
For example, using a content ID of 12345
and video ID of sample-video
:
- Type the following from a command-line prompt:
curl --data "" "http://dai.google.com/ondemand/hls/content/12345/vid/sample-vide/streams"
-
(Optional) Pipe to
python -mjson.tool
to view in pretty print.
Sample output *
{
"duration": 784,
"stream_id": "19b40be0-7942-44ca-97e0-fc7b27f14029",
"stream_manifest": "https://dai.google.com/ondemand/hls/content/12345/vid/sample-video/CHS/streams/19b40be0-7942-44ca-97e0-fc7b27f14029/master.m3u8",
"stream_type": "on_demand",
"subtitles": [ ... ],
"time_events_url": "https://dai.google.com/ondemand/hls/content/12345/vid/sample-video/CHS/streams/19b40be0-7942-44ca-97e0-fc7b27f14029/time-events.json"
}
* You may be able to use the stream_manifest
URL to test playback in an HLS player (for example, the Safari web browser).
Find a session ID in an SSB stream request
When you use SSB to request a Dynamic Ad Insertion (DAI) video stream, there are two HTTP requests:
- The HTTP
GET
request, which should return with a 302 status, indicating a redirect. - The HTTP
GET
request to the redirected URL. This URL contains the "session ID" which you should enter into the "Sessions identifier" field.
You can also find a session ID when you monitor HTTP requests in a proxy tool from a mobile or OTT application.
Find a session ID for an SSB stream request using Chrome
-
Load the content stream URL in a browser.
For example, using a content ID of
12345
and video ID ofsample-video
, load:
http://dai.google.com/ondemand/hls/content/12345/vid/sample-video/master.m3u8
- In Chrome, load Developer Tools.
- Navigate to the Network tab of Developer Tools.
- Filter for requests that include
dai.google.com
. -
The first two requests to the "dai.google.com" domain should be for a file named "master.m3u8":
First request: The 302 response
Second request: The URL with the session ID
- Copy the session ID and enter it into the Sessions identifier field.