surmon-china / videojs-player

@videojs player component for @vuejs(3) and React.
https://github.surmon.me/videojs-player
MIT License
5.28k stars 1.13k forks source link

使用官方列子rtmp直播时,报错 videojs 未定义 #185

Open wangyano0 opened 6 years ago

wangyano0 commented 6 years ago

楼主你好,使用官方列子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,则会报另一个错 40960063-2ccad1ae-68d1-11e8-9eb8-cb6c9d285237

还请楼主大大看见了回复一下,万分感谢!

wangyano0 commented 6 years ago

已解决 解决方式 将 import “videojs-flash” 改变成 require('videojs-flash/dist/videojs-flash.js') 就可以了。虽然不知道是什么原因。还请楼主大大能够注意一下

shen-lan commented 6 years ago

一模一样的错误。 使用你的方法无效 你的vue-video-player什么版本?

surmon-china commented 6 years ago

我猜又是 webpack 的锅

surmon-china commented 6 years ago

125

wjy18666 commented 6 years ago

rtmp播放loading加载效果也没有出现