西瓜播放器 HTML5 video video.js 播放器 HTML5播放器 mp4 hls hls.js flv flv.js dash dash.js 无缝切换

第三方库

xgplayer-flv.js

A extension plugin which integrated hls.js based on xgplayer, it can support play hls video

install

$ npm install xgplayer
$ npm install xgplayer-flv.js

Usage

html

  <div id="vs"></div>

js

import Player from 'xgplayer'
import 'xgplayer/dist/index.min.css'
import FlvJsPlugin from 'xgplayer-flv.js'

const player = new Player({
        id: 'vs',
        url: '../xgplayer-demo.hls',
        plugins: [FlvJsPlugin],
        flvJsPlugin: {} // config for plugin FlvJsPlugin
        // If use CDN loading,you can Get the plugin through window.FlvJsPlugin
    })

xgplayer-hls.js

A extension plugin which integrated hls.js based on xgplayer

install

$ npm install xgplayer
$ npm install xgplayer-hls.js

Usage

html

  <div id="vs"></div>

js

import Player from 'xgplayer'
import 'xgplayer/dist/index.min.css'
import HlsJsPlugin from 'xgplayer-hls.js'

const player = new Player({
        id: 'vs',
        url: '../xgplayer-demo.hls',
        plugins: [HlsJsPlugin],
        hlsJsPlugin: {} // config for plugin HlsJsPlugin
        // If use CDN loading,you can Get the plugin through window.HlsJsPlugin
    })

xgplayer-dash

A extension plugin based on xgplayer, it can support play dash video

install

$ npm install xgplayer
$ npm install xgplayer-dash

Usage

html

  <div id="vs"></div>

js

import Player from 'xgplayer'
import 'xgplayer/dist/index.min.css'
import DashPlugin from 'xgplayer-dash'

const player = new Player({
        id: 'vs',
        url: '../xgplayer-demo.hls',
        plugins: [DashPlugin],
        DashPlugin: {} // config for plugin DashPlugin
        // If use CDN loading,you can Get the plugin through window.DashPlugin
    })

xgplayer-shaka

A extension plugin which integrated shaka-player based on xgplayer

install

$ npm install xgplayer
$ npm install xgplayer-shaka

Usage

html

  <div id="vs"></div>

js

import Player from 'xgplayer'
import 'xgplayer/dist/index.min.css'
import ShakaPlugin from 'xgplayer-shaka'

const player = new Player({
    id: 'vs',
    url: '../xgplayer-demo.hls',
    plugins: [ShakaPlugin],
    shakaPlugin: {} // config for plugin ShakaPlugin
    // If use CDN loading,you can Get the plugin through window.ShakaPlugin
})