html5 - 在Vue.js項(xiàng)目中如何使用阿里云視頻點(diǎn)播的Web播放器SDK
問題描述
在Vue.js項(xiàng)目中如何使用阿里云視頻點(diǎn)播的Web播放器SDK?
阿里云的官方文檔頁面:https://help.aliyun.com/docum...
我的代碼:
<template><p class=''> <p style='position: absolute'></p></p></template><style></style><script>var player = new prismplayer({ id: ’J_prismPlayer’, width: ’100%’, autoplay: false, //播放方式一:推薦 prismType: 2, vid: ’’, accId: ’’, accSecret: ’’, apiKey: ’’, // vid : ’’, // playauth : ’’, showBarTime: 3000000, cover: ’http://liveroom-img.oss-cn-qingdao.aliyuncs.com/logo.png’});export default { created: function() { }}</script>
報(bào)錯(cuò):
prism-h5-min.js:2 Uncaught TypeError: 沒有為播放器指定容器 at new i (prism-h5-min.js:2) at eval (eval at <anonymous> (app.js:1555), <anonymous>:4:14) at Object.<anonymous> (app.js:1555) at __webpack_require__ (app.js:687) at fn (app.js:110) at eval (eval at <anonymous> (app.js:1562), <anonymous>:7:3) at Object.<anonymous> (app.js:1562) at __webpack_require__ (app.js:687) at fn (app.js:110) at eval (eval at <anonymous> (app.js:1053), <anonymous>:19:77)
問題解答
回答1:在index.html引入js 然后在build/webpack.base.conf.js中找到webpackConfig 里面配置
externals: { 'prismplayer': 'prismplayer'}
在你的項(xiàng)目中
export default { mounted: function() { let player = new prismplayer({ id: ’J_prismPlayer’, width: ’100%’, autoplay: false, //播放方式一:推薦 prismType: 2, vid: ’’, accId: ’’, accSecret: ’’, apiKey: ’’, // vid : ’’, // playauth : ’’, showBarTime: 3000000, cover: ’http://liveroom-img.oss-cn-qingdao.aliyuncs.com/logo.png’ }); }}
相關(guān)文章:
1. 我在centos容器里安裝docker,也就是在容器里安裝容器,報(bào)錯(cuò)了?2. docker內(nèi)創(chuàng)建jenkins訪問另一個(gè)容器下的服務(wù)器問題3. 在windows下安裝docker Toolbox 啟動(dòng)Docker Quickstart Terminal 失敗!4. docker不顯示端口映射呢?5. docker-compose中volumes的問題6. golang - 用IDE看docker源碼時(shí)的小問題7. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””8. docker容器呢SSH為什么連不通呢?9. javascript - 連續(xù)點(diǎn)擊觸發(fā)mouseleave事件10. mac里的docker如何命令行開啟呢?

網(wǎng)公網(wǎng)安備