vue xgplayer 引入_xgplayer-vue: Vue component for xgplayer, a HTML5 video player with a parser that sa...

Introduction

xgplayer is a web video player library. It has designed a separate, detachable UI component based on the principle that everything is componentized. More importantly, it is not only flexible in the UI layer, but also bold in its functionality: it gets rid of video loading, buffering, and format support for video dependence. Especially on mp4

it can be staged loading for that does not support streaming mp4. This means seamless switching with clarity, load control, and video savings. It also integrates on-demand and live support for FLV, HLS, and dash. Document

xgplayer-vue is the Vue component which encapsulating the xgplayer.

Start

Install

$ npm install xgplayer-vue@latest

Usage

Step 1. Add xgplayer-vue component

import Xgplayer from 'xgplayer-vue';

export default {

components:{

Xgplayer

}

}

Step 2. Use in template

Step 3. Config for xgplayer

export default {

data () {

return {

config: {

id: 'vs',

url: '/xgplayer-demo.mp4'

},

Player: null

}

}

}

You can use 'config' object to pre-config xgplayer, such as size, volume, autoplay and so on. More config

'mp4', 'hls', 'flv', 'dash' are supported to play and you should add the plugin you want to use. Functional Plugins List.

'Player' is the xgplayer instance which exposed from the component. You can use 'Player' to access the API of xgplayer as follows.

API

Attributes

console.log(this.Player.currentTime)

Method

this.Player.pause();

Event

this.Player.on('play', ()=>{console.log('play')})

Life Cycle

this.Player.once('ready', ()=>{console.log('ready')})

Plugins

xgplayer supports your custom plugins for more content viewing plugins

import Xgplayer from 'xgplayer-vue';

import 'xgplayer-custom';

Demo

$ git clone git@github.com:bytedance/xgplayer-vue.git

$ cd xgplayer-vue

$ npm install

$ npm start

License

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值