dplayer-vue

0.1.1 • Public • Published

DPlayer-Vue

A Vue video player component based on DPlayer.

NPM version NPM downloads

Install

npm install dplayer-vue -S

Usage

import VueDPlayer from "dplayer-vue"

export default {
  components: {
    "d-player": VueDPlayer,
  },
}

OR

import Vue from "vue"
import VueDPlayer from "dplayer-vue"
Vue.use(VueDPlayer)

Props

Options Doc

Name Type Default Description
options Object -- all player options

Example:

<d-player :options="options"></d-player>

export default {
    data() {
      return {
        options: {
          apiBackend: {
            read: (callback) => {
              callback.error()
              callback.success()
            },
            send: (callback) => {
              callback.error()
              callback.success()
            }
          }
        }
      }
    }

Events

Event binding Doc

Example:

<d-player @play="play"></d-player>

export default {
    methods: {
      play() {
        console.log('play callback')
      }
    }

API

you can use all DPlayer APIs

Example:

<d-player ref="player"></d-player>

export default {
    mounted() {
      const player = this.$refs.player.dp
      player.play()
      setTimeout(() => {
        player.pause()
      }, 2000)
    }

Related

License

This content is released under the MIT License.

Package Sidebar

Install

npm i dplayer-vue

Weekly Downloads

22

Version

0.1.1

License

MIT

Unpacked Size

3.24 kB

Total Files

3

Last publish

Collaborators

  • gujian