Viewer SDK
By integrating Viewer SDK, you can get a live broadcast experience with delay, higher quality, and smoother playback, including a variety of exciting interactive gameplay, such as voting, polling, lottery, interactive chat, product association and other displays.
Demo experience
You can use the SDK demo playground modify the template code and preview the effect in real time to achieve online effect debugging. See the Viewer SDK demo playground for details.
Installation
npm install @byteplus/live-sdk
Usage
Notice: Viewer SDK handles many compatibility issues for PC and mobile separately internally, so you need to ensure that you import the corresponding scripts and CSS files in the corresponding UA.
CDN
Reference https://docs.byteplus.com/en/byteplus-livesaas/docs/integrating-the-web-viewer-sdk
NPM
import '@byteplus/live-sdk/dist/pc/js/index.js'
import '@byteplus/live-sdk/dist/pc/css/index.css'
import '@byteplus/live-sdk/dist/mobile/js/index.js'
import '@byteplus/live-sdk/dist/mobile/css/index.css'
var webSDK = new window.ByteLiveWebSDK({
activityId: *************,
token: '****',
service: '',
mode: 1,
modules: [
{
id: "player",
mode: "player",
},
{
id: "menu",
mode: "menu",
menu: ["comment"],
}
],
options: {}
})
webSDK.emit('player.pause');
webSDK.on('player.pause', () => {});