Usage
SwarmCloud
# Register Domain
Register your domain to activate P2P service.
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 (opens new window)
# Include
# Script
<script src="https://cdn.jsdelivr.net/npm/cdnbye-shaka@latest"></script>
# File
# Browserify / Webpack
npm install --save cdnbye-shaka
To include cdnbye you need to require it in the player module:
var P2PEngineShaka = require('cdnbye-shaka');
If you are using ES6's import syntax:
import P2PEngineShaka from 'cdnbye-shaka';
# Usage
var player = new shaka.Player(video);
if (P2PEngineShaka.isSupported()) {
new P2PEngineShaka(player);
}
player.load(play_url)
# Electron
CDNBye also supports Electron (opens new window), you just need to register AppId and get a token from CDNBye console:
new P2PEngineShaka(player, {
token: YOUR_TOKEN,
appName: YOUR_APP_NAME, // 应用的名称
appId: YOUR_APP_ID, // 需要与控制台输入的保持一致
// Other p2pConfig options if applicable
});
Learn more here