Retrieves information about the asset corresponding to the content being played.
Request syntax:
Request syntax (playback session ID):
If available, you must specify a playback session ID.
Define the following variable(s) when submitting the above request:
VariableA variable represents a value that must be replaced. A variable consists of either a URL segment (e.g., "0001" in /0001/) or a query string value (e.g., "3" in mediaTypes=3). | Description |
---|---|
Required |
Replace this variable with the system-defined ID assigned to the asset being played. Use the CMS or parse the playback URL to find this asset ID. Ads The asset ID for other content being played (e.g., server-side ads) is only discoverable via either of the following methods:
|
Required |
Replace this variable with the playback session ID. Use the Preplay API to retrieve the playback session ID (sid). If available, you must specify a playback session ID. |
The response for a successful request contains the following parameters:
Response Parameter |
Type |
Description |
---|---|---|
audio_only |
Number |
Returns 1 when the asset has been flagged as audio only. Valid values are: 0 | 1
|
boundary_details |
Array |
Indicates the offset and duration, in seconds, for each boundary in the asset. |
error |
Number |
Returns 1 when an error occurred with the asset. Valid values are: 0 | 1
|
tv_rating |
Number |
Indicates the asset's TV rating. Valid values are:
|
Number |
Indicates the total number of slices available for this asset. |
|
String |
Indicates the base URL for thumbnails. |
|
Number |
Indicates the average duration, in seconds, for each slice. |
|
movie_rating |
Number |
Indicates the asset's movie rating. Valid values are:
|
owner |
String |
Indicates the user IDA user ID uniquely identifies a user account via an alpanumeric system-defined ID. for the asset's owner. |
meta |
Object |
Returns the asset's metadata. Add metadata to an asset via the CMS, Live Slicer API, or the Asset API. |
rates |
Array |
Reports the asset's available bitrates as a collection of number values. |
Array |
Contains an object for each available thumbnail resolution. |
|
poster_url |
String |
Indicates the URL for the poster image. Set an asset's poster image via the CMS or the Asset API. |
duration |
Number |
Indicates the asset's duration in seconds. |
default_poster_url |
String |
Indicates the permanent URL to the asset's default poster image. |
desc |
String |
Indicates the asset's description. |
rating_flags |
Number |
Indicates the set of rating flags assigned to the asset via a number derived from a bitwise operation on rating flags (DLSV). Sample values are provided below.
|
external_id |
String |
Indicates the asset's external ID. |
is_ad |
Number |
Returns 1 when the asset has been flagged as an ad. Valid values are: 0 | 1
|
asset |
String |
Indicates the asset's system-defined ID. |
The following sample response contains information about the asset being played.
{ "audio_only": 0, "boundary_details": [{ "c3": { "duration": 73.1093, "offset": 362.024 } }, { "c7": { "duration": 104.9706, "offset": 596.2079 } }, { "halftime": { "duration": 1022.605, "offset": 996.232 } }, { "c3": { "duration": 115.23, "offset": 2525.123 } }, { "c7": { "duration": 135.1655, "offset": 3002.6599 } } ], "error": 0, "tv_rating": -1, "max_slice": 148, "thumb_prefix": "http://stg-ec-ore-u.uplynk.com/slices/...http://stg-ec-ore-u.uplynk.com/slices/062/e2cb36cb397f47a18371e18f40ec01b7/062048d702734ca6a38f3e7f8e4f4488/", "slice_dur": 4.010666666666666, "movie_rating": -1, "owner": "e2cb36cb397f47a18371e18f40ec01b7", "meta": {}, "rates": [55, 105, 198, 348, 580, 995, 2055], "thumbs": [{ "width": 128, "prefix": "", "bw": 128, "bh": 128, "height": 72 }, { "width": 256, "prefix": "upl256", "bw": 256, "bh": 256, "height": 144 } ], "poster_url": "http://stg-cf-ore.uplynk.com/slices/...http://stg-cf-ore.uplynk.com/slices/062/e2cb36cb397f47a18371e18f40ec01b7/062048d702734ca6a38f3e7f8e4f4488/00000014.jpg", "duration": 596.4800000000015, "default_poster_url": "http://stg-ec-ore-u.uplynk.com/slices/...http://stg-ec-ore-u.uplynk.com/slices/062/e2cb36cb397f47a18371e18f40ec01b7/062048d702734ca6a38f3e7f8e4f4488/00000014.jpg", "desc": "Big Buck Bunny", "rating_flags": 0, "external_id": "", "is_ad": 0, "asset": "062048d702734ca6a38f3e7f8e4f4488" }
Key information:
Use the following parameters to render a thumbnail from an asset:
This example demonstrates how to generate a thumbnail 60 seconds into the asset using the above sample response.
Step 1 - Slice Duration
The first step is to figure out the duration of each slice by examining the slice_dur parameter.
"slice_dur": 4.010666666666666,
Based off of the slice_dur parameter, we know that thumbnails will be generated approximately every 4.01 seconds.
The slice_dur parameter indicates the average duration of each slice in seconds. This means that a new slice is generated approximately every 4.01 seconds. Thumbnails are generated at the start of each new slice. Therefore, thumbnails are generated approximately every 4.01 seconds.
Additionally, we know that the first thumbnail (00000000.jpg) will always be generated at 0 seconds. This means that the second slice and the second set of thumbnails will be generated at approximately 4.01 seconds.
Step 2 - Slice Number
The next step is to figure out the slice that corresponds to the 60 second mark by using the following formula:
var sliceNum : Number = Math.ceil( playerTime / assetInfo.slice_dur); // using the response data above. // sliceNum = 15
As shown above, the 15th slice corresponds to the 60 second mark.
Step 3 - Available Slices
The next step is to verify that this value does not exceed the total number of slices available for this asset by comparing it to the max_slice parameter.
"max_slice": 148,
Step 4 - Construct File Name
Since sliceNum is less than max_slice, we can proceed to convert sliceNum (i.e., 15) to a hex string (i.e., F) and then use this hex value to construct the thumbnail's base file name (0000000F.jpg).
Step 5 - Construct Thumbnail URL
Use the following syntax to construct the thumbnail URL:
Find the base URL for all thumbnails via the thumb_prefix parameter.
"thumb_prefix": "http://stg-ec-ore-u.uplynk.com/slices/...http://stg-ec-ore-u.uplynk.com/slices/062/e2cb36cb397f47a18371e18f40ec01b7/062048d702734ca6a38f3e7f8e4f4488/",
Find the prefix for the desired resolution by examining the thumbs array.
"thumbs": [{ "width": 128, "prefix": "", "bw": 128, "bh": 128, "height": 72 }, { "width": 256, "prefix": "upl256", "bw": 256, "bh": 256, "height": 144 } ],
For example, use the following URL to generate a 256x144 thumbnail:
Use either segment map data from our SDKs or the Preplay API to retrieve the playback session ID and index information.
A segment map contains a list of segment objects. Each object contains the following information:
Retrieve the following information via our SDKs:
To generate thumbnail URLs when server-side ads are present
Load thumbnails by:
Learn more about generating thumbnail URLs.
Example
Assuming both of the following conditions:
You should load the thumbnail at the 30 second mark.