vue-dplayer 视频播放器实例代码
官网
vue-dplayer
dplayer-doc
示例
如果默认options中没有视频链接,之后设置视频链接时,直接通过this.options.video.url=videoPath是无效的
需要先获取到播放器的实例this.$refs.player.dp,然后通过switchVideo()对url进行修改
importdPlayerfrom'vue-dplayer' import'vue-dplayer/dist/vue-dplayer.css' exportdefault{ name:'in-video', props:{ source:{ type:String, default:'' } }, data(){ return{ player:null, options:{ video:{ url:'' }, contextmenu:[ {} ] } } }, mounted(){ this.player=this.$refs.player.dp }, created(){ this._setVideoUrl(this.source) }, methods:{ //设置视频播放路径 _setVideoUrl(url){ this.player.switchVideo({ url:url }) } }, components:{ dPlayer } }
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。