Skip to main content

Usage

Register Domain

Register your domain to activate the P2P service.

tip

Localhost is always whitelisted, so no additional configuration is needed to test locally.

Integrate to HTML5 Players

See the player integration guide

Include

Script

Include the pre-built script for the latest version:

<script src="https://cdn.jsdelivr.net/npm/@swarmcloud/dashjs"></script>

File

Download here
This needs to be included before your player code. You can either prepend it to your compiled code or include it in a <script> before it.

Browserify / Webpack

npm install --save @swarmcloud/dashjs

To include @swarmcloud/dashjs, require it in your player module:

var P2PEngineDash = require('@swarmcloud/dashjs');

If you're using ES6 import syntax:

import P2PEngineDash from '@swarmcloud/dashjs';

Usage

Create an instance of dashjs#MediaPlayer, then create a P2PEngineDash instance passing player as a parameter.

var player = dashjs.MediaPlayer().create()
if (P2PEngineDash.isSupported()) {
var p2pConfig = {
logLevel: 'debug',
// Other p2pConfig options if applicable
};
new P2PEngineDash(player, p2pConfig);
}
// Use dash.js just like your usual dash.js…

Electron

CDNBye also supports Electron — simply register an AppId and get a token from the CDNBye console:

p2pConfig: {
token: YOUR_TOKEN,
appName: YOUR_APP_NAME,
appId: YOUR_APP_ID,
// Other p2pConfig options if applicable
}

Learn more here