Skip to main content

Usage

Register Domain

Register your domain to activate P2P service.

tip

Localhost is always whitelisted. This means that you do not have to configure anything to perform tests locally.

Integrate to HTML5 Players

See Player Integration

Include

Script

Include the pre-built script of latest version:

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

File

Click me
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 you need to require it in the player module:

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

If you are using ES6's import syntax:

import P2PEngineDash from '@swarmcloud/dashjs';

Usage

Create an instance of dashjs#MediaPlayer , then create P2PEngineDash instance passing player as 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, you just need to register AppId and get a token from CDNBye console:

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

Learn more here