楼主你好,使用官方列子rtmp直播时 报错'videojs' 未定义; vue-video-player 版本是v5.0.2,已引入“video-flash” 版本是 v2.0.1;
报错信息如下:
videojs-flash.es.js?e023:323 Uncaught TypeError: Cannot read property 'videojs' of undefined
at new Flash (videojs-flash.es.js?e023:323)
at Player.loadTech (video.cjs.js:20155)
at Player.src (video.cjs.js:21962)
at eval (video.cjs.js:21910)
at setSourceHelper (video.cjs.js:9329)
at setSourceHelper (video.cjs.js:9331)
at Player.eval (video.cjs.js:9163)
at bound (video.cjs.js:2285)
楼主你好,使用官方列子rtmp直播时 报错'videojs' 未定义; vue-video-player 版本是v5.0.2,已引入“video-flash” 版本是 v2.0.1; 报错信息如下: videojs-flash.es.js?e023:323 Uncaught TypeError: Cannot read property 'videojs' of undefined at new Flash (videojs-flash.es.js?e023:323) at Player.loadTech (video.cjs.js:20155) at Player.src (video.cjs.js:21962) at eval (video.cjs.js:21910) at setSourceHelper (video.cjs.js:9329) at setSourceHelper (video.cjs.js:9331) at Player.eval (video.cjs.js:9163) at bound (video.cjs.js:2285)
自己解决方式 将 ‘videojs ’引入到window 还是报错; import videojs from "video.js"; window.videojs = videojs; 以下是代码: import videojs from "video.js"; window.videojs = videojs; import "videojs-flash";
playerOptions: { autoplay: true, muted: true, language: "en", playbackRates: [0.7, 1.0, 1.5, 2.0], sources: [ { type: "rtmp/mp4", src: "rtmp://184.72.239.149/vod/&mp4:BigBuckBunny_115k.mov" } ], techOrder: ["flash"], autoplay: false, controls: true, poster: "https://surmon-china.github.io/vue-quill-editor/static/images/surmon-1.jpg", height: 540 }, 如果单独安装了“video.js” 版本是v7.0.1,则会报另一个错
还请楼主大大看见了回复一下,万分感谢!