xgplayer-vue

Vue component for xgplayer, a HTML5 video player with a parser that saves traffic
4,850 241
Install
npm install xgplayer-vue
Latest Version:1.1.5
Vue:2
License:MIT
Last Updated:Jul 5, 2021
Links: GitHub  ·  npm
Maintainer: hqx_bytedance

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

  1. Install

    $ npm install xgplayer-vue@latest
    
  2. Usage

    Step 1. Add xgplayer-vue component

    import Xgplayer from 'xgplayer-vue';
    export default {
      components:{
        Xgplayer
      }
    }
    

    Step 2. Use in template

    <Xgplayer :config="config" @player="Player = $event"/>
    

    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)

More attributes

Method
this.Player.pause();

More methods

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

More events

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

More events

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

please visit http://localhost:9090/index.html

License

MIT

Related Packages

easy-player

rtmp, hls, flv and websocket player

4,257
hrm-player

A videojs player component for Vue.js

1,299 21
vue-better-dplayer

Better use of HLS ,Flv with the latest DPlayer

3,100 4
@somoe-net/somoe-video

A Vue 3 video player component with HLS/FLV support

4
vue-aliplay-player

阿里云 Aliplayer 的 Vue 3 播放器组件封装(v4 for Vue 3,Vue 2 项目请使用 3.x)

657 0

Version History

Version Released Vue License
1.1.5 ^2.5.2 MIT
1.1.3 ^2.5.2 MIT
1.1.2 ^2.5.2 MIT
Pre-releases (1)
Version Released Vue License
1.1.4-beta ^2.5.2 MIT