Media Sharing with the Media API

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

Media sharing is a feature of Brightcove that lets publishers share videos with other publishers, enabling you to more easily manage videos across multiple accounts. This topic describes how to share videos using the Media API. For introductory information, read:

Media sharing is available only for Brightcove Pro and Enterprise customers. If you are interested in upgrading your Brightcove account, please contact Brightcove for more information.

The share_video method

The Brightcove Media API includes a share_video method you can use to share a video with an affiliate. The share_video method has this signature:

share_video(token:String, video_id:Long, sharee_account_ids:Long, auto_accept:Boolean):Long

To use the share_video method, pass:

  • your Media API write token
  • the ID of the video you want to share
  • a comma-separated array of the Brightcove account IDs of the affiliates you want to share the video with
  • optionally, if your affiliate has configured its account to automatically accept shared videos, set auto_accept=true

For example, to share a video with the ID 123 with two affiliates whose Brightcove account IDs were 456 and 789, you could post something like this to http://api.brightcove.com/services/post/:

{"method": "share_video",
    "params": {"token" : "riBfgveLvpRb-rHGiBBouSAXs-Q8NmphGxt0z04kE.",
               "video_id" : 123,
               "sharee_account_ids":[456,789]}}

Click here to see a sample page that uses JavaScript, an HTML form, and the share_video method to share videos.

Click here to see the source code for this example.

Deleting shared videos

The delete_video method has an optional delete_shares argument. In order to delete a video that has been shared, you must call delete_video with delete_shares="true". In that case, the video will be deleted from your account, as well as from all accounts with which the video has been shared. The delete_shares argument is optional, but if you attempt to delete a video that has been shared without using this argument, the method will fail with an error.

share_video Error Messages

The share_video method can produce the following error messages:

message description
The video specified was not found. Brightcove did not find a video with the specified video ID in your account.
Invalid video id: null You passed null as the video ID.
Shared videos cannot be re-shared. You tried to share a video that your account received by sharing. Only the original account that uploaded the video.
Invalid sharee account idx: ? value: null
(where ? is the index within the passed list of account IDs)
You passed null as one of the sharee account IDs.
Sharing is not allowed to account: ?
(where ? is an account id)
A sharing relationship has not been established between your account and one of the accounts whose account ID you passed. Either the account ID is wrong, or sharing has not been set up between your account and the sharee account. Contact customer support to set up the sharing relationship.
Tags
media sharing, syndication