Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
70 lines (52 sloc) 3.19 KB


Build Status npm version


The BoxCast SDK for tvOS/TVML video playback allows you to develop your own tvOS TVML applications to watch content from your BoxCast account.

The SDK provides a set of Promise-based methods for querying data from your account and a method of attaching to a native tvOS Player in order to provide viewer analytics back to your BoxCast account.


npm install boxcast-sdk-tvos --save


Import the module and initialize constants.

const { BoxCastData, BoxCastPlayer } = require('boxcast-sdk-tvos');

const YOUR_CHANNEL_ID = ' TODO: fill in from dashboard ';
const YOUR_APP_NAME = ' TODO: unique identifier used for analytics ';

List broadcasts that are currently live...

var api = new BoxCastData();
api.getLiveBroadcasts(YOUR_CHANNEL_ID).then((broadcasts) => {
    // for each broadcast in broadcasts, note the
    //,, broadcast.description, broadcast.preview

... or VOD.

api.getArchivedBroadcasts(YOUR_CHANNEL_ID).then((broadcasts) => {
    // for each broadcast in broadcasts, note the
    //,, broadcast.description, broadcast.preview

When ready to watch a broadcast, simply initialize a player for the broadcast and call the present method, which will request the playlist from the BoxCast API and present a native tvOS player if available.

var player = new BoxCastPlayer(broadcast, {HOSTNAME: YOUR_APP_NAME});
    .then((tvOSPlayerInstance) => { ... })
    .catch((errorMessage) => { ... });

The SDK also exposes vendor libraries (Bluebird Promise polyfill, fetch polyfill) for your use as needed.

const { vendor } = require('boxcast-sdk-tvos');
const { Promise, fetch } = vendor;

Known Limitations

  • This SDK is for viewing and querying of broadcasts on accounts that do not protect their content with pay-per-view ticketing, host restrictions, geoblocking, passwords, or other authentication means. The BoxCast API will reject requests for such content, so you should be prepared to handle errors using the .catch((err) => { ... }) method of the data promises.


  • v1.0.0: Initial version
  • v1.1.0: Add shortcut for initializing Player for broadcast with metrics service already attached
  • v1.1.3: Fix build so modules can be imported properly into TVML runtime