提示:作者没有兼容vue3,只兼容了vue2.在vue3中不支持npm的方式引入,需要在index.html中以script标签的方式进行注册。
1,下载easyplayer(这只是为了方便找到EasyPlayer-element.min.js文件)
npm i @easydarwin/easyplayer --save
2,将EasyPlayer-element.min.js文件去‘/node_modules/@easydarwin/easyplayer/dist/component’中找到并复制到public文件下
3,在index.html文件中使用script标签引入这个js文件
<script type="text/javascript" src="/EasyPlayer-element.min.js"></script>
这样就实现了全局的注册easyplayer组件了
4,在vue3项目的任意vue文件中使用'easy-player'标签()
注意:这里写成'video-url',(不知道你们是什么情况,反正我是之前写的videoUrl结果一直不出来),这个给上流数据的网络地址即可。还有一点,要注意给easy-player一个固定宽高的容器。
<easy-player class="player" :video-url="vUrl" autoplay :live="true"></easy-player>