clappr / clappr-chromecast-plugin

Chromecast support for clappr
BSD 3-Clause "New" or "Revised" License
38 stars 19 forks source link

Clappr Chromecast Plugin

A Clappr plugin that adds Chromecast support on Chrome browser. As with all apps running on Chromecast it requires the Google Cast extension installed on the browser.

Please notice it's still not production ready, as it lacks a way to select tracks (audio, subtitles), as well as display media information.

Usage

<html>
  <head>
    <script src="https://cdn.jsdelivr.net/npm/clappr@latest/dist/clappr.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/clappr-chromecast-plugin@latest/dist/clappr-chromecast-plugin.min.js"></script>
  </head>

  <body>
    <div id="player"></div>
    <script>
      var player = new Clappr.Player({
        source: '//clappr.io/highline.mp4',
        plugins: [ChromecastPlugin],
        parentId: '#player',
        chromecast: {
          appId: '9DFB77C0',
          contentType: 'video/mp4',
          media: {
            type: ChromecastPlugin.Movie,
            title: 'Awesome Hot Air Balloon Slackline',
            subtitle: 'You won\'t get much closer to Skylining than this!'
          },
          customData: {
            licenseURL: 'http://widevine/yourLicenseServer'
          }
        }
      });
    </script>
  </body>
</html>

There's also a demo page.

Plugin parameters

The plugin parameters are passed through the embed parameters object under the chromecast key:

Development

Install dependencies:

npm install

Build:

npm run build

Run:

npm start