langyuxiansheng / vue-aliplayer-v2

这是一个基于Alipayer 开发并封装成vue组件的播放器.可播放rtmp,m3u8,mp4....视频.除支持直播流与点播的基础功能外,也支持视频的加密播放、清晰度切换、直播时移等业务场景等.https://help.aliyun.com/document_detail/125548.html?spm=a2c4g.11186623.3.3.4bafbf80OVkZJ9
https://langyuxiansheng.github.io/vue-aliplayer-v2/
MIT License
275 stars 59 forks source link

播放器创建时报错 #6

Closed hugo2017 closed 4 years ago

hugo2017 commented 4 years ago

按照例子编写了代码,打开页面报错,播放器不显示。

aliplayer-min.js:2 Uncaught TypeError: e.toLowerCase is not a function
    at Object.f.exports.isRTMP (aliplayer-min.js:2)
    at Object.f.exports.handleOption (aliplayer-min.js:2)
    at Object.t.exports.create (aliplayer-min.js:2)
    at a (aliplayer-min.js:2)
    at VueComponent.initPlayer (vue-aliplayer-v2.umd.min.js?5806:1)
    at HTMLScriptElement.eval (vue-aliplayer-v2.umd.min.js?5806:1)

templat

<vue-aliplayer-v2 ref="aliPlayer"
                        id="player-001"
                        class="video-player"
                        :source="source"
                        :options="aliPayerOpts">
 </vue-aliplayer-v2>

js代码

aliPayerOpts: {
          source: 'http://static.smartisanos.cn/common/video/t1-ui.mp4',  // 视频播放地址url
          vid: '', //阿里视频资源库vid
          playauth: '', //播放权证
          cover: 'https://img.alicdn.com/tps/TB1EXIhOFXXXXcIaXXXXXXXXXXX-760-340.jpg',  // 视频封面url地址
          height: '200',
          width: '320',
          preload: true,
          isLive: false,
          autoplay: false,
          useH5Prism: true,
          format: 'mp4'
        },

如果删除 template 中的 :source="source",初始可以播放例子视频,但无法更换source。

hugo2017 commented 4 years ago

补充一下,data中定义 source: '//player.alicdn.com/video/aliyunmedia.mp4',这样的话,会报错: vue.runtime.esm.js?2b0e:619 [Vue warn]: Invalid prop: type check failed for prop "source". Expected Object, got String with value "http://static.smartisanos.cn/common/video/t1-ui.mp4".

langyuxiansheng commented 4 years ago

好的您的问题反馈已收到,正在进行验证

langyuxiansheng commented 4 years ago

请问您现在使用的版本是多少的呢,以及您使用的场景?目前最新版本的为1.1.8

langyuxiansheng commented 4 years ago

感谢您的反馈,您提的问题在1.1.9的版本中已经修复了,原因是定义的String的类型,然后默认值返回的是 ()=> null