DPlayer-Vue
A Vue video player component based on DPlayer.
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
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
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.