Quantcast
Channel: Video Cloud Overview Recent
Viewing all articles
Browse latest Browse all 2356

Accessing a Video's Custom Metadata

$
0
0
8

Custom metadata is available only for Video Cloud Pro and Enterprise customers. If you are interested in upgrading your Video Cloud account, please contact Brightcove for more information.

After you have set up custom metadata for your Video Cloud account, you can set values for the custom metadata fields of your videos. You can set and read metadata for a video using the Media module, FTP batch provisioning, or the Media API. This topic describes how to use the Player API or BEML to access custom metadata for your videos.

Note: If you are just getting started using custom fields, Brightcove recommends you use the Player API and/or the CMS API to programmatically access custom field information. For more information, see Programmatically accessing custom metadata fields.

Before you begin

Before you can set custom metadata for your videos, you need to set up the custom metadata fields that you want to be available in your account. Read about how to do this.

Accessing Custom Metadata with the Player APIs

A video's custom metadata are accessible with the Player APIs in the customFields property of the VideoDTO. Each defined custom metadata field can be accessed using dot notation. For example, if you have defined a custom metadata field with the internal name specialLinkURL, you could access it like this, using the Smart Player API (the sample assumes that you already have a reference to the Video Player Module stored as videoPlayer):

videoPlayer.getCurrentVideo( function(videoDTO) {
    var url = videoDTO.customFields.specialLinkURL;
    document.findElementById("sponsorImage").innerHTML = "<img src=\""+ url + "\" />";
  });

Similar methods are available in the Flash-only Player API:

 

var video:VideoDTO = videoPlayer.getCurrentVideo();
var url:String = video.customFields.specialLinkURL;
navigateToURL(new URLRequest(url));

 

Note that you must access a custom metadata field using its internal name, not its display name.

Accessing Custom Metadata in a Custom Player Template

In a custom player template, you can similarly access a video's custom metadata via the video's customFields property and access each defined custom metadata field accessed using dot notation. For example, suppose you have defined custom metadata fields with the internal names specialLinkURL and specialLinkText. This BEML element would display the value of the currently-loaded video's specialLinkText in a link that goes to the specialLinkURL.

<Link text="{videoPlayer.video.customFields.specialLinkText}"
      url="{videoPlayer.video.customFields.specialLinkURL}"/>

Note that you must access a custom metadata field using its internal name, not its display name.


Viewing all articles
Browse latest Browse all 2356

Trending Articles