VePlayer
BytePlus Web player SDK,can automatically adapt to PC and H5 scenes, support MP4, HLS, FLV, DASH and other formats of on-demand and live broadcast, combined with video cloud, it has functions such as playback quality log reporting, encrypted playback, etc.
Import the SDK
Install SDK dependencies into the project through the package management tool.
npm install @byteplus/veplayer --save
Import VePlayer and style files in the project.
import VePlayer from '@byteplus/veplayer';
import '@byteplus/veplayer/index.min.css';
Add playback container
Add a player container on the page where the player needs to be displayed, for example, add the following code to index.html.
<div id="video"></div>
Player instantiation
After getting the video URL, instantiate the player.
Video On Demand
const player = new VePlayer({
id: 'video',
url: "https://demo.vod.com/xxx.mp4",
vodLogOpts: {
vtype: 'MP4',
tag: 'Normal',
line_app_id: 235399,
line_user_id: 'XXX'
}
});
For a detailed description of VOD, refer toBytePlus - Video On Demand - Player SDK - Web
Live
const playerSdk = new VePlayer({
id: 'video',
isLive: true,
url: '//livepull.example.com/appname/streamname.flv'
});