<div align="center">
<img src="https://raw.githubusercontent.com/bytedance/xgplayer/master/xgplayer.png" width="384" height="96">
</div>
<div align="center">
<a href="https://www.npmjs.com/package/xgplayer-vue" target="_blank">
<img src="https://img.shields.io/npm/v/xgplayer-vue.svg" alt="npm">
</a>
<a href="https://www.npmjs.com/package/xgplayer-vue" target="_blank">
<img src="https://img.shields.io/npm/l/xgplayer-vue.svg" alt="license">
</a>
<a href="http://commitizen.github.io/cz-cli/">
<img src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg" alt="commitizen">
</a>
</div>
### 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](http://h5player.bytedance.com/en/)
xgplayer-vue is the Vue component which encapsulating the xgplayer.
### Start
1. Install
```
$ npm install xgplayer-vue@latest
```
2. Usage
Step 1. Add xgplayer-vue component
```js
import Xgplayer from 'xgplayer-vue';
export default {
components:{
Xgplayer
}
}
```
Step 2. Use in template
```html
<Xgplayer :config="config" @player="Player = $event"/>
```
Step 3. Config for xgplayer
```js
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](http://h5player.bytedance.com/en/config/)
'mp4', 'hls', 'flv', 'dash' are supported to play and you should add the plugin you want to use. [Functional Plugins List](http://h5player.bytedance.com/en/plugins/#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
```js
console.log(this.Player.currentTime)
```
[More attributes](http://h5player.bytedance.com/en/api/#attributes)
#### Method
```js
this.Player.pause();
```
[More methods](http://h5player.bytedance.com/en/api/#method)
#### Event
```js
this.Player.on('play', ()=>{console.log('play')})
```
[More events](http://h5player.bytedance.com/en/api/#event)
#### Life Cycle
```js
this.Player.once('ready', ()=>{console.log('ready')})
```
[More events](http://h5player.bytedance.com/en/api/#life-cycle)
### Plugins
xgplayer supports your custom plugins for more content viewing [plugins](http://h5player.bytedance.com/en/plugins/)
```js
import Xgplayer from 'xgplayer-vue';
import 'xgplayer-custom';
```
### Demo
```
$ git clone [email protected]:bytedance/xgplayer-vue.git
$ cd xgplayer-vue
$ npm install
$ npm start
```
please visit [http://localhost:9090/index.html](http://localhost:9090/index.html)
### License
[MIT](http://opensource.org/licenses/MIT)

一起快走吧
- 粉丝: 48
最新资源
- 基于WebService的数据库同步系统的设计与实现.doc
- 天网前端接入系统施工验收规范.doc
- 项目管理软件P3training.pptx
- 中央数据交换平台建设及统一接口规范介绍.pptx
- (源码)基于Arduino和C++的简易电子开关控制器.zip
- Automatica 顶刊复现:移动机器人编队独轮车编队分布式非线性与鲁棒控制:leader-follower群体控制问题 轨迹规划 高级版
- 基于单片机的计步器设计.docx
- 基于单片机的高效省时豆浆机控制器设计.doc
- 焦秉立-医疗物联网.ppt
- 合力天下CAD图纸外发控制方案.doc
- 通信与广电专业工程施工.doc
- 运用Excel对综合逐步结转成本还原【会计实务操作教程】.pptx
- 合作开发软件协议书.docx
- 中国电信湘潭分公司移动网络工程机房单位工程施工组织设计.doc
- 上海大连路隧道网络方案.doc
- 外文文献及翻译:信息系统开发和数据库开发.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


