谷歌存储视频文件不能直接从本地主机角度播放 [英] google storage vedio files cannot plays directly from localhost angular

查看:102
本文介绍了谷歌存储视频文件不能直接从本地主机角度播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已被CORS政策阻止:所请求的资源上没有 Access-Control-Allow-Origin标头。因此,不允许访问来源' http:// localhost:4200 '。

has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.

尝试从Google存储空间加载wave文件时显示此消息。

this message when trying to load wave file from google storage.

我尝试了以下步骤,但不起作用,
使用gsutil在桶中配置CORS的cors命令:
https://cloud.google .com / storage / docs / configuring-cors

i tried these steps but it doesn't work, Use the gsutil cors command to configure CORS on a bucket: https://cloud.google.com/storage/docs/configuring-cors

推荐答案

如果您使用的是Chrome,我想提到Chrome不支持CORS请求的本地主机(自2010年以来打开的错误)[1],如果检查此错误的线程,则会发现今年的最新评论,因此,此错误仍在解决中

If you are using Chrome, I want to mention that Chrome does not support localhost for CORS requests (an error opened since 2010) [1], if you inspect the thread of this error, you will find the last comment made this year, therefore, this error is still in process for be resolved

要解决此问题,您可以使用类似lvh.me的域(就像localhost一样指向127.0.0.1)或使用--disable-web-security启动chrome标记(假设您是ju

To get around this you can use a domain like lvh.me (which points at 127.0.0.1 just like localhost) or start chrome with the --disable-web-security flag (assuming you're just testing).

也可以检查如何在此文档的Origin上使用通配符[2]

Also you can check how you can use wildcards on Origin on this document[2]

[1] https://bugs.chromium.org/p/铬/问题/细节?id = 67743

[2] https://cloud.google.com/storage/docs/xml-api/put-bucket-cors

这篇关于谷歌存储视频文件不能直接从本地主机角度播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆