Skip to content

boxcast/boxcast-sdk-tvos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

 

Build Status npm version

boxcast-sdk-tvos

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.

Installation

npm install boxcast-sdk-tvos --save

Usage

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.id, broadcast.name, broadcast.description, broadcast.preview
});

... or VOD.

api.getArchivedBroadcasts(YOUR_CHANNEL_ID).then((broadcasts) => {
    ...
    // for each broadcast in broadcasts, note the
    // broadcast.id, broadcast.name, 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});
player.present()
    .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.

Changelog

  • 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

About

The official BoxCast SDK for integrating with the BoxCast API in TVML applications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published