EasyPlayer.js 在VUE中使用

本文介绍如何在遇到UncaughtReferenceError:videojsisnotdefined错误时,通过安装和配置@easydarwin/easyplayer及copy-webpack-plugin来解决前端音视频播放问题。包括详细步骤和在index.html中正确引用资源。

楔子

不是专业的前端,只是 需要使用,网上各种博客都是 官方那些,可以按照操作后 提示Uncaught ReferenceError: videojs is not defined

解决

官网地址

npm install @easydarwin/easyplayer --save
npm install --save-dev copy-webpack-plugin  

1 copy-webpack-plugin

在这里插入图片描述

npm install --save-dev copy-webpack-plugin

webpack.dev.conf.js

## 引入
const CopyWebpackPlugin = require('copy-webpack-plugin')

在 module  plugins 配置 上述
    new CopyWebpackPlugin([

        { from: 'node_modules/@liveqing/liveplayer/dist/component/crossdomain.xml'},
            { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer.swf'},
            { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer-lib.min.js', to: 'js/'},
          {from :'node_modules/@easydarwin/easyplayer/dist/component/EasyPlayer.swf'},
          {from :'node_modules/@easydarwin/easyplayer/dist/component/crossdomain.xml'},
          {from :'node_modules/@easydarwin/easyplayer/dist/component/EasyPlayer-lib.min.js'},
            {
              from: path.resolve(__dirname, '../static'),
              to: config.dev.assetsSubDirectory,
              ignore: ['.*']
            },
    ])

2 在index.html中引用

在这里插入图片描述

没有在index.html中引入 就会 提示 Uncaught ReferenceError: videojs is not defined

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值