Customer Sign In

upLynk

AssetInfo API

Overview

The assetinfo API is used to get metadata information to the client about the current playing asset. The URL structure is as follows:

http://content.uplynk.com/player/assetinfo/<assetID>.json
-or-
http://content.uplynk.com/player/assetinfo/<assetID>.json?pbs=<playback session id&gt

If the playback session id is available then it must be used

Response Data

The asset info API returns a JSON response containing the metadata.

Example Response
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
    "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/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/062/e2cb36cb397f47a18371e18f40ec01b7/062048d702734ca6a38f3e7f8e4f4488/00000014.jpg",
    "duration": 596.4800000000015,
    "default_poster_url": "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"
}
            
Property Values
audio_onlyNumber {0|1}false / true - If asset is flagged as being audio only.
boundary_detailsArrayInformation for each boundary in the asset (offset and duration in seconds)
errorNumber {0|1} false / true - If there was an error with this asset.
tv_ratingNumber -1 - Not Available
0 - Not Rated
1 - TV-Y
2 - TV-Y7
3 - TV-G
4 - TV-PG
5 - TV-14
6 - TV-MA
7 - Not Rated
max_sliceNumberCount of how many slices are available for this asset
thumb_prefixURLPrefix url to the thumnails
slice_durNumberAverage slice duration
movie_ratingNumber-1 - Not Available
0 - Not Applicable
1 - G
2 - PG
3 - PG-13
4 - R
5 - NC-17
6 - X
7 - Not Rated
ownerGUIDOwner ID
metaObjectMetadata attached to this asset
Note: Metadata can be added in the upLynk CMS
ratesArrayAvailabe Bitrates
thumbsArrayAvailable thumbnail resolutions
poster_urlURLPoster URL
Note: This value can be modified through the CMS
durationNumberDuration of the asset
default_poster_urlURLThis is the default poster image created for this asset. This value doesn't change.
descStringAsset Description
rating_flagsNumberD - Sexually suggestive dialog is present
V - Violence is present
S - Sexual situations are present
L - Adult Language is present

This number is a bitwise number to indiate if one or more of these values are present.

[D][V][S][L] - 0 = No rating flags
[D][V][S][L] - 1 = Language Flag
[D][V][S][L] - 2 = Sex Flag
[D][V][S][L] - 4 = Violence Flag
[D][V][S][L] - 8 = Drugs Flag
[D][V][S][L] - 15 = All Flags are on.
external_idGUIDAn ID to reference from an external source
is_adNumber {0|1}false / true - If this asset is flagged as being an AD
assetGUIDThis Asset ID

Where to get the asset id

There are several locations where you can find the asset id and use it to load the asset info call. Below is a list of locations.

CMS

The CMS allows you to view the asset ids. Just click on the asset. Then in the right panel click the gears icon. In that section you'll see a GUID. This is the asset id for your selected asset.

Parse from URL

The asset id can be parsed from a standard URL. It'll be the last GUID in the URL. for example, with a URL such as: http://content.uplynk.com/062048d702734ca6a38f3e7f8e4f4488.m3u8. the asset id will be: 062048d702734ca6a38f3e7f8e4f4488.

This will only give you the asset id for the main asset. It wont give you any information about other assets in that asset. for example, if the asset has server side ads then it'll not give the asset id's for those server side ads. You will need to get those by using the preplay or the SegmentMap API available in the various upLynk SDKs.

Preplay API

This API is used for third party platforms. Inside the response data is is the asset id and playback session id (sid). Click Here to view the docs.

SegmentMap API

Each of the SDK's provided by upLynk include an interface called SegmentMap. This interface returns a list of segments in a play out. The information inside the SegmentMap will indicate where ad breaks are located. Their asset ids and everything else needed to render ad indicators and and properly render thumbnails.

Generating the thumbnail URL

The asset info call returns everything you need in order to render thumbnails for an asset. The parameters that we'll be using are:

  • slice_dur - The Duration of each slice
  • thumb_prefix - Prefixed URL
  • thumbs - list of various thumbnail sizes
  • max_slice - the max number of slices

Thumbnails are stored as an eight character hex string with a ".jpg" extension. The first thumbnail in an asset will always be 00000000.jpg and the second will be 00000001.jpg. There is a thumbnail for the start of every slice. Using the response data above, this means that thumbnail 00000000.jpg will located at 0 seconds and 00000001.jpg will be located at 4.010666666666666 seconds. So in order to get the thumbnail located at 60 seconds into the asset. We would use the following formula:

1
2
3
4
var sliceNum : Number = Math.ceil( playerTime / assetInfo.slice_dur);
// using the response data above.
// sliceNum = 15
        

First we will want to make sure that this sliceNum is less than or equal to our max_slice value. If it is, Then we proceed with converting the sliceNum to a hex string. We would end up getting 0000000F.jpg as our asset. Next we have to build the rest of the URL. We do this by first using the thumb_prefix and add the prefix from thumbs based on the resolution of the thumbnail we want to be using.

For example if we want to use the 256 x 256 thumbnails. Our final URL would be:
http://stg-ec-ore-u.uplynk.com/slices/062/e2cb36cb397f47a18371e18f40ec01b7/062048d702734ca6a38f3e7f8e4f4488/upl2560000000F.jpg

Generating the thumbnail URL with server side ads

This example will use the SegmentMap API. However the same can be used with the preplay API. The SegmentMap will contain a list of segment objects. Each object will contain the following.

  • Asset ID
  • Type (of it is an ad or segment)
  • Index
  • Position
  • Duration

You will also need the following information from the SDK.

  • Domain
  • Playback Session ID (sid or pbs)

When you get the segment map data. You'll want to go ahead and load each asset info call using the asset id. Make sure to load and cache each response. Once when you have all of this information cached. You can start to load thumbnails. Based on the information in the segment map. You can loop through the map to find out where a thumbnail needs to be pulled from. For example, If we wanted to load a thumbnail at 60 seconds into the asset. but the segment map indicates that we had an ad at that start of the playback. that means we would want to load the thumbnail at the 30 second mark.

The segment map also provides an Index value. This value should be added onto the sliceNum before converting the string to hex. This will help get the proper offset in the stream when there are multiple ads in the play out.