我有一个基本项目,并且正在运行[[vue.js并且运行laravel,但是我需要在所有浏览器上播放HLS视频,所以看了之后,我决定使用video-js。
我已经通过npm成功安装了视频播放器,并尝试复制以下指南:https://docs.videojs.com/tutorial-vue.html但是我仍然收到以下控制台错误:
[[Vue警告]:安装的挂钩中出现错误:“ TypeError:元素或ID 提供的无效。 (videojs)“
为什么这对我不起作用?
我已将我的代码上传到github:https://github.com/samB67/VueVideoJS/blob/master/VideosView.vueMp4视频有效,但HLS视频无效
<video-js>
不是组件。使用视频html标签和ref代替。<video ref="Player" class="vjs-default-skin" controls preload="auto" width="640" height="268">
<source src="https://www.w3schools.com/html/mov_bbb.mp4">
</video>
在脚本部分:
mounted() { videojs(this.$refs.Player); }