bytedance / xgplayer

A HTML5 video player with a parser that saves traffic
https://h5player.bytedance.com/
MIT License
8.17k stars 858 forks source link

使用 flv 插件在https协议地址播放http协议直播流报跨域,已配置crossOrigin: 'anonymous', #1355

Closed YWSGM closed 5 months ago

YWSGM commented 5 months ago

您使用的西瓜播放器版本是多少? What version of xgplayer are you using? "xgplayer": "^3.0.14", "xgplayer-flv": "^3.0.14"

您使用的操作系统和浏览器分别是? What OS and browser are you using? chrome mac 14.1.2

如何复现问题? How to reproduce the problem? 使用 https 协议网址播放 http 视频流报跨域,但是已经设置配置 const option: IPlayerOptions = { id: 'my-player', url: record.flv, isLive: true, plugins: [FlvPlugin], height: '537px', width: '1040px', fluid: true, autoplay: true, autoplayMuted: true, lang: 'zh', videoAttributes: { 111 }, }

您期望的播放器正常行为是? What did you expect to happen? 正常直播http协议直播流

实际播放器的表现是? What actually happened? 无法正常播放,报跨域 111

可填写您所在的公司和相关产品业务,方便我们提供更好的技术支持 You can write your company and product which uses xgplayer, for helping us provide better technical support.

YWSGM commented 5 months ago

const option: IPlayerOptions = { id: 'my-player', url: record.flv, isLive: true, plugins: [FlvPlugin], height: '537px', width: '1040px', fluid: true, autoplay: true, autoplayMuted: true, lang: 'zh', videoAttributes: { crossOrigin: 'anonymous', }, } if (!option.url) return if (!playerRef.current) { playerRef.current = new XGPlayer(option) playerRef.current.on('error', () => {}) playerRef.current.on('play', () => {}) } else { playerRef.current.setConfig(option) }

xiyuyizhi commented 5 months ago

@YWSGM 浏览器限制,https页面下不允许http协议请求