Sharing Multiple Videos

This sample uses the CMS API via JavaScript and a proxy (PHP) to share multiple videos with one or more affiliate accounts.


In this sample, you will learn how to share multiple videos from a master account to one or more affiliate accounts using the CMS API.


Source code

Find all the code associated with this sample in this GitHub repository.

Sample app

See the Pen CMS API Sample: Share Multiple Videos by Brightcove Learning Services (@rcrooks1969) on CodePen.


  1. The response to an API request to share a video will include all shares for the video, not just the affiliate(s) indicated in the request. Be aware of this when you look at the responses.
  2. This app does NOT check to see if affiliates have approved the sharing contract. If not, shares will fail.
  3. This app does NOT check to see if a selected video has already been shared with a selected affiliate. If you reshare a video already shared with an affiliate, any metadata changes made by the affiliate will be overwritten.
  4. This app does NOT check for sharing errors. Sharing may fail because of custom field mismatches between the master and affiliate account, or other reasons. Look at the responses to the video share requests to see if there are any errors.

The last three limitations above can be removed by adding additional code to your own version of this app. We have not added the code in the interest of keeping the sample app logic as simple to understand as possible.

Requirements to use this app

In order to use this app, you will need to get some prerequisites in place:

  1. The master account must be enabled for media sharing - if it is not, contact your Customer Success Manager or Brightcove Support
  2. You must have client credentials for the master account that enabled for media sharing operations (see the Get credentials section below)
  3. You must have a default channel (this channel is set up automatically when media sharing is enabled for your account)
  4. You must have one or more affiliates added to the channel - if you have not done that, you can do it in Studio or by using this companion app for adding multiple affiliates.

Using the CodePen

Here are some tips to effectively use the above CodePen:

  • Toggle the actual display of the player by clicking the Result button.
  • Click the HTML/CSS/JS buttons to display ONE of the code types.
  • Click Edit on CodePen in the upper right corner to fork this CodePen into your own account.
  • Find all the code associated with this sample in this GitHub repository.

Proxy code

In order to build your own version the sample app on this page, you must create and host your own proxy. (The proxies used by Brightcove Learning Services only accept requests from Brightcove domains.) A sample proxy, very similar to the one we use, but without the checks that block requests from non-Brightcove domains, can be found in this GitHub repository. You will also find basic instructions for using it there, and a more elaborate guide to building apps around the proxy in Using the REST APIs.