Overview
As of version 6.2.0+, the Brightcove Native SDK for Android supports methods for creating video and playlist objects from a JSON object.
This is useful if you want to use a server-side proxy to retrieve video and playlist data from your Brightcove account. With this approach, you won't expose your Policy Keys on the client side of your apps.
To create a playable video and playlist object, do the following:
- Optional: Make a server-side call to the Playback API to return your video or playlist data.
- Create a JSON-formatted object based on the required fields below.
- Pass in the JSON-formatted object and call the appropriate method to create the following:
- Load the returned video or playlist into your player.
Video objects
To create a video object, pass the following information to the buildVideoFromJSON()
method:
Field | Description |
---|---|
account_id |
The account id associated with the video |
id |
The video id |
sources |
A JSON array of video sources. Each source in the array must have:
|
duration |
The video duration in milliseconds |
When your server-side proxy returns video data, build a JSON object string with the values specified in the table above.
Convert the JSON string to a JSON object and pass it to the to the buildVideoFromJSON()
method:
Playlist objects
To create a playlist object, pass the following information to the buildPlaylistFromJSON()
method:
Field | Description |
---|---|
account_id |
The account id associated with the video |
id |
The video id |
videos |
A JSON array of video objects. This includes the required fields as described in the Video objects section. |
duration |
The video duration in milliseconds |
When your server-side proxy returns playlist data, build a JSON object string with the values specified in the table above.
Convert the JSON string to a JSON object and pass it to the buildPlaylistFromJSON()
method:
Notes
If your content is governed by TTL (Time to live) and you want to create a long-lived video object, you will need to ensure it continues to be playable. This is configured on the CDN that you are using.