Ajax YouTube 上传
我正在尝试实现可断点续传的视频上传到 Youtube, 如下所述:youtube 可续传上传 API。
但我收到错误:“NetworkError: 404 Not Found - http: //uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads”。
这是代码:
var http = new XMLHttpRequest(); var url = "http://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads"; http.open("POST", url, true); http.setRequestHeader("Host", "uploads.gdata.youtube.com"); http.setRequestHeader("Authorization", "AuthSub token=\"yDXi4sfOb8RYWDIH....MEAxMzE0MzAzMDEy\""); http.setRequestHeader("GData-Version", 2); http.setRequestHeader("X-GData-Key", "key=DI39si4Tl....18OaRy"); http.setRequestHeader("Content-length", 0); http.setRequestHeader("Slug", "test.avi"); http.send(null);
我将不胜感激您的帮助。
I'm trying to implement resumable video upload to Youtube,
as described here: youtube resumable upload api .
But I am getting error: "NetworkError: 404 Not Found - http://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads".
Here is code:
var http = new XMLHttpRequest(); var url = "http://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads"; http.open("POST", url, true); http.setRequestHeader("Host", "uploads.gdata.youtube.com"); http.setRequestHeader("Authorization", "AuthSub token=\"yDXi4sfOb8RYWDIH....MEAxMzE0MzAzMDEy\""); http.setRequestHeader("GData-Version", 2); http.setRequestHeader("X-GData-Key", "key=DI39si4Tl....18OaRy"); http.setRequestHeader("Content-length", 0); http.setRequestHeader("Slug", "test.avi"); http.send(null);
I would be grateful for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
浏览器不支持可续传上传和直接上传功能 - 特别是它们违反了浏览器同源策略。您需要使用基于浏览器的上传或代理通过您的服务器上传。
The resumable upload and direct upload facilities are not supported from browsers -- in particular they violate browser same origin policies. You need to either use the browser based uploading or proxy the uploads through your server.