muiplayer / hello-muiplayer

💡 An excellent HTML5 video player component
https://muiplayer.js.org/
GNU General Public License v3.0
503 stars 100 forks source link

加载远程vtt字幕文件时,浏览器会报:“ Unsafe attempt to load URL aaa from frame with URL bbb ”错误,导致加载不了字幕 #25

Open iamithunk opened 2 years ago

iamithunk commented 2 years ago

电脑网页观看视频,加载远程vtt字幕文件时,会出现Unsafe attempt to load URL aaa from frame with URL bbb 错误,加载不了字幕。但是同样的配置,换成videojs播放器是可以加载解析远程字幕的,且浏览器不会报错。

muiplayer commented 2 years ago

加载 vtt 字幕文件的网络资源

您好,请问 vtt 文件的网络资源地址是否与网站地址同源呢?如果域名非同源这可能是跨域导致的,请切换到同源地址后尝试。

请查阅:同源政策(CORS)、html5 video crossorigin

iamithunk commented 2 years ago

不与网站地址同源,并且服务器已经对vtt做了跨域处理,所以videojs显示字幕是没问题的。我的意思是说同样的服务器配置,这个播放器出错,videojs却不出错,并且看报错是frame框架禁止载入非同源文件,是不是字幕显示机制不同呢?可否避免?

在 2022年3月11日,00:41,MuiPlayer @.***> 写道:



加载 vtt 字幕文件的网络资源

您好,请问 vtt 文件的网络资源地址是否与网站地址同源呢?如果域名非同源这可能是跨域导致的,请切换到同源地址后尝试。

请查阅:同源政策(CORS)、html5 video crossorigin

— Reply to this email directly, view it on GitHubhttps://github.com/muiplayer/hello-muiplayer/issues/25#issuecomment-1064270039, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWXGPL5CTKQO7RLMQCDHV3TU7IQ4DANCNFSM5QNCLKZQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>