【发布时间】:2021-03-20 05:21:15
【问题描述】:
我在使用 Vimeo 上传 API 将视频从我们的网页上传到 Vimeo 时遇到了问题,即使我已将正确的“接受”标头设置为 Vimeo 的 API 页面上指定的 3.4 版。任何人都可以建议为什么 redirect_url 参数不起作用?其他一切正常并且视频已上传,但不会发生重定向。这是我的完整页面:
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link href="/include/jquerymmenu/jquery.mmenu.all.css" type="text/css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="application/javascript">
$.ajax({
type: 'POST',
url: 'https://api.vimeo.com/me/videos',
upload: {
approach: "post",
redirect_url: 'https://www.example.com'
},
headers: {
'Authorization': 'bearer ' + '<<my token here>>',
'Content-Type': 'application/json',
'Accept': 'application/vnd.vimeo.*+json;version=3.4'
},
success: function(res){
console.log(res);
// Write the form to the page
$("div#myform").html(res.upload.form);
},
error: function(err){
console.log(err);
}
});
</script>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<div id="myform"></div>
</body>
</html>
【问题讨论】:
-
当您说“不发生重定向”时,究竟发生了什么?您是否被带到另一个页面,页面是否重新加载,您是否遇到错误消息或其他?
-
上传完成后,用户会被带到默认的 Vimeo“上传完成”页面,这是根据 Vimeo 文档设计的。
标签: javascript ajax upload vimeo-api