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.

Demo​

See the player demo

Include​

Script​

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

File​

Click me

Browserify / Webpack​

npm install --save @swarmcloud/bitmovin

To include the P2P engine, require it in your player module:

var P2pEngineBitmovin = require('@swarmcloud/bitmovin');

If you're using ES6 import syntax:

import P2pEngineBitmovin from '@swarmcloud/bitmovin';

Usage​

var conf = {
key: YOUR_BITMOVIN_LICENSE_KEY,
playback: {
preferredTech: [
{player: 'html5', streaming: 'hls'}
]
},
live:{
lowLatency:{
targetLatency: 30
}
},
};
var engine = new P2pEngineBitmovin({
// trackerZone: 'hk', // if using Hongkong tracker
// trackerZone: 'us', // if using USA tracker
// token: YOUR_TOKEN
});
conf.network = engine.getNetworkConfig();
var player = new bitmovin.player.Player(document.getElementById('player'), conf);
engine.setPlayer(player);
player.load(play_url);

File Explanation​

@swarmcloud/bitmovin/
├── bitmovin-p2p-engine.min.d.ts # Typescript type information
├── bitmovin-p2p-engine.min.js # P2pEngine that supports both Dash and Hls
└── bitmovin-p2p-engine.dash.min.js # P2pEngine that supports Dash only
└── bitmovin-p2p-engine.hls.min.js # P2pEngine that supports Hls only