vue中Liveplayer的使用

liveplayer和easyplayer使用方法很相似,属性也基本相同,下面开始liveplayer使用方法:
1.npm安装liveplayer、copy-webpack-plugin

npm install @liveqing/liveplayer
npm install [email protected] --save-dev

也可在package.json文件中直接添加版本号,然后执行yarn install 或 npm install:

"dependencies": {
  "@liveqing/liveplayer": "2.3.3",
},
"devDependencies": {
  "copy-webpack-plugin": "^4.0.1",
}

2.在vue.config.js文件中配置

const CopyWebpackPlugin = require('copy-webpack-plugin')
...
new CopyWebpackPlugin([
  { from: 'node_modules/@liveqing/liveplayer/dist/component/crossdomain.xml' },
  { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer-lib.min.js', to: 'js/' },
  { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer.swf' },
  { from: 'node_modules/@liveqing/liveplayer/dist/element/liveplayer-element.min.js', to: 'js/' },
])

3.在public/index.html中引入js静态资源
注意:文件位置要与上面配置的to...相同,上面配置是的 to: 'js/',所以底下地址是./js




4.在vue中使用


...
import LivePlayer from '@liveqing/liveplayer'
...
components: { LivePlayer }

你可能感兴趣的:(vue.js)