Giter VIP home page Giter VIP logo

awesome-video-player's Introduction

Awesome-Video-Player

Version License

A Vue.js based video player with good look and custom user config

good-looking & support custom config

Vue 2 & Vue 3 Support

m3u8 video format Support

How to Use

1. Install

npm install awesome-video-player

2. configure player

  • properties: Video properties.

  • videoStyle: Video style.

  • controlsConfig: Video control settings.

That's it, enjoy!

Support events

Event name When to trigger
play The media has received a request to start playing
pause Playback has been suspended
canplay Playback can start
ended The media has played once and stopped
waiting Pause playback to download more data
canplaythrough Playback can continue and should not be interrupted. Readstate is 3
error A network error occurred during the download
volumechange The value of the volume or muted property has changed
emptied The network connection is down
ratechange Media playback rate changes
empty An error occurred, blocking media download
seeking Playback has moved to a new location
timeupdate The current time was changed unconventionally or unexpectedly
stalled The browser tried to download but has not received data yet
abort Download interrupted

Example

<template>
  <div id="app">
    <awesome-video
      :properties="videoOption.properties"
      :videoStyle="videoOption.videoStyle"
      :controlsConfig="videoOption.controlsConfig"
      @play="playVideo"
      @canplay="canplayVideo"
      @pause="pauseVideo"
    ></awesome-video>
  </div>
</template>

<script>
import AwesomeVideo from "awesome-video-player";
export default {
  name: "App",
  components: {
    AwesomeVideo
  },
  data: () => ({
    videoOption: {
      properties: {
        poster: require("./assets/logo.png"),
        src:
          // "https://mos-vod-drcn.dbankcdn.cn/P_VT/video_injection/2A1343EFA/v3/6CC21C811065945606293295744/MP4Mix_H.264_1920x1080_6000_HEAAC1_PVC_NoCut.mp4",
          "https://tv.youkutv.cc/2019/11/12/mjkHyHycfh0LyS4r/playlist.m3u8",
        preload: "auto",
        // loop: "loop",
        // autoplay:"autoplay",
        // muted:true
      },
      videoStyle: {
        // width: "1200px",
        // height: "600px",
      },
      controlsConfig: {
        fullScreenTit:"全屏",
        EscfullScreenTit:"退出全屏",
        speedTit:"倍速",
        volumeTit:"音量",
        muteTit:"静音",
        playTit:"播放",
        pauseTit:"暂停",
        fullScreen:true,
        speed:true,
        listen:true
      }
    },
  }),
  methods:{
    playVideo(){
      console.log("play");
    },
    pauseVideo(){
      console.log("pause");
    },
    canplayVideo(){
      console.log("canplay");
    }
  }
};
</script>

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.