GithubHelp home page GithubHelp logo

bytedance / xgplayer-vue Goto Github PK

View Code? Open in Web Editor NEW
232.0 10.0 53.0 137.66 MB

Vue component for xgplayer, a HTML5 video player with a parser that saves traffic

License: MIT License

JavaScript 89.35% HTML 1.53% Vue 9.13%

xgplayer-vue's Introduction

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 [email protected]:bytedance/xgplayer-vue.git
$ cd xgplayer-vue
$ npm install
$ npm start

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

License

MIT

xgplayer-vue's People

Contributors

chenguzhen87 avatar xiterjia avatar zhangxin92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xgplayer-vue's Issues

文件这么大么,

文件这么大么,下载到55%,就卡死了,
工程哪里有问题,git更新不下来啊

The requested module '/node_modules/xgplayer/dist/index.js?v=f9f41c0b' does not provide an export named 'default'

按readme.md配置的。

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

</template>

<script>
import Xgplayer from 'xgplayer-vue';
export default {
  data () {
    return {
      config: {
        id: 'vs',
        url: 'http://127.0.0.1:8080/xgplayer-demo.mp4'
      },
      Player: null
    }
  }
}
</script>

没啥问题吧。

报错

The requested module '/node_modules/xgplayer/dist/index.js?v=f9f41c0b' does not provide an export named 'default'

无法监听除了ready以外的事件

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

this.Player.on('ready', ()=>{ console.log('ready') })
正常输出 => // ready

this.Player.on('play', ()=>{ console.log('play') })
无法监听play事件

怎么设置进度条禁用?

配置里面 ignores:[‘progress’] 未生效,就算不能关闭,那禁用进度条的点击和拖动也可以啊

想问问url配置不能用本地视频吗

开发中...

<script>
import Xgplayer from 'xgplayer-vue'
export default {
  name: 'App',
  components: {
    Xgplayer,
  },
  data() {
    return {
      config: {
        id: 'vs',
        url: './assets/video/wn.mp4',
        // poster: './assets/img/舞娘.jpg',
      },
      Player: null,
    }
  },
}
</script>

确定路径以及文件名无误,但是 开发调试的时候控制台一直报错
image

想问问是模块问题吗?

我测试了一下在线视频 好像是没问题的
image

vue2,无法监听到多个单词的事件

能监听到play、focus、ratechange、volumechange 单个单词的事件 监听不到 fullscreen_change、cssFullscreen_change、autoplay_started,这种是监听不到的,

chrome更新了最新版本后,视频无法渲染

chrome版本: 89.0.4389.90(正式版本) (64 位)
os:windows
xgplayer-vue版本:1.1.5
已知:mac正常,低版本时正常(85.0),用其他浏览器打开正常
问题描述:没有显示封面,,显示为底色,鼠标移到原本播放键处可点击播放。已确认封面链接没问题

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.