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.
- 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.
- This app does NOT check to see if affiliates have approved the sharing contract. If not, shares will fail.
- 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.
- 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:
- The master account must be enabled for media sharing - if it is not, contact your account manager or Brightcove Support
- You must have client credentials for the master account that enabled for media sharing operations (see the Get credentials section below)
- You must have a
defaultchannel (this channel is set up automatically when media sharing is enabled for your account)
- 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.
CodePenFind all the code associated with this sample in this GitHub repository.
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.
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.