Setting Schedule Information with the Media API

Product
Video Cloud
Applies to Roles
Developer
Version
Brightcove 5
Modules
Media API
Edition
Pro, Enterprise

A video can have scheduling restrictions, enabling you to limit the availability of a video by selecting a start date, an end date, or both. You can, for example, choose to have a video be available indefinitely, starting at a specific date and time. By default, videos have no scheduling information and are available indefinitely when they are active. You can set a video's scheduling information using the Media module, using FTP batch provisioning (with the start-date and end-date attributes of the <title> element), or using the Media Write APIs, as described in this topic.

A video's scheduling restrictions are set in the Video object's startDate and endDate properties. These properties are Dates, represented as the number of milliseconds since the Unix epoch. Here's a utility that converts human-readable dates to UNIX dates in seconds. (There are many others on the web, including epochconverter.com.)

  • The startDate must be earlier than the endDate.
  • If endDate is null, the video will never cease being available because of schedule restrictions.
  • If startDate is null, the video is available immediately.

You can set these scheduling properties when you initially create a video, using the create_video method, or you can modify them subsequently, using the update_video method. In either case, you would include the property names and values in the JSON for the Video that you pass. For example, passing the following JSON makes the video available starting immediately (because we set startDate to null) and ending on November 12, 2010 (the equivalent of 1289520000000 milliseconds):

{"params": {"token":"9fFiMGiBB0usSRe36g3vYwayybMA.",
 "video": {"name":"MyVideo","id":"24687531",
           "startDate":null,"endDate":"1289520000000",
           "shortDescription":"Video not available after 2010.11.12"}
           },
"method": "update_video"}

 

Tags
scheduling