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.

Demo

See Player Demo

Include

Script

<script src="https://cdn.jsdelivr.net/npm/@swarmcloud/rx-player@latest"></script>

File

Click me

Browserify / Webpack

npm install --save @swarmcloud/rx-player

To include p2p engine you need to require it in the player module:

var P2pEngineRxPlayer = require('@swarmcloud/rx-player');

If you are using ES6's import syntax:

import P2pEngineRxPlayer from '@swarmcloud/rx-player';

Usage

var rxConfig = {
url: YOUR_PLAYLIST_URL,
transport: "dash",
autoPlay: true,
}

const rxPlayer = new RxPlayer({
videoElement: document.getElementById("videoplayer")
});

var engine = new P2pEngineRxPlayer(rxPlayer, {
// trackerZone: 'hk', // if using Hongkong tracker
// trackerZone: 'us', // if using USA tracker
// token: YOUR_TOKEN
})

rxPlayer.loadVideo(rxConfig);