Accessing Video Content with the Media API

Applies to Roles
Developer
Version
Brightcove 4
Modules
Media API
Edition
Pro, Enterprise

The basic use cases for the read methods in the Brightcove Media API focus on accessing the metadata of the videos and playlists in your Brightcove account. This topic describes how you can use the Media API to access the videos themselves. The technique described in this topic is available for progressive download (PD) media assets; it is not available for streaming (FMS) media assets.

When you use a read method in the Media API to get a video, you specify which properties of the video you want to be returned with the video_fields parameter in the method call. For example, to get a video's name and duration, you might use a find_video_by_id call like this:

http://api.brightcove.com/services/library?command=find_video_by_id&video_id=149210661776
  &video_fields=name,length&token=0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.

The FLVURL property of a Video object represents the URL of the video. If you want to get the URL of the video itself, and not just its metadata, add FLVURL to the fields parameter:

http://api.brightcove.com/services/library?command=find_video_by_id&video_id=149210661776
  &video_fields=name,length,FLVURL&token=0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.

Note that the FLVURL property of a Video object represents the video's URL, no matter whether the video's encoding is FLV (VP6) or H.264.

Accessing multi-bitrate streaming renditions

If this video includes multiple renditions for multi-bitrate streaming, the URL returned is for the default rendition. If you want to get all of the renditions, include the renditions property in the fields that you want returned:

http://api.brightcove.com/services/library?command=find_video_by_id&video_id=149210661776
  &video_fields=name,renditions&token=0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.

The renditions property is included by default in the fields returned; if multiple renditions exist and if you have the proper URL token, the renditions will be returned unless you specify the fields you want and do not include renditions in the fields. Note that you can access the URL only if you have enabled delivery of videos by progressive download, not just streaming.

Security for Video URLs

You need to be even more careful about guarding access to the URLs for your video assets than you do for your video metadata. To provide better security, the Media API requires a special token to allow access to the FLVURL property of videos. Your regular Media API read or write token will not work for this purpose. Read about how to get the special Media API token for read access or a token for write access to the FLVURL property.

Tags