WISTIA 上传卡在 100%
WISTIA upload stuck at 100%
我正在使用 Wistia API 上传视频。根据 Wistia 文档,代码似乎没问题,但是当我上传文件时,它显示进度从 0% 到 100%,但在达到 100% 后,哨兵在控制台中记录了以下错误:
Uncaught TypeError: this.wRemoteRequestor.post is not a function
此错误指向位于 https://fast.wistia.com/assets/external/api.js 的以下行的 wistia js 文件:
this.wRemoteRequestor.post(i, {
dataType: "json",
success: function(e) {
r.transformToCreateMediaResponse(e),
e.data.originalUrl = "".concat(r.generateExtensionlessOriginalUrl(o), ".bin"),
r.wistiaUploader._onSuccessRaw(e)
},
error: function(e) {
r.wistiaUploader._onError(e)
}
})
代码如下:
<div id="wistia-upload-widget" style="height:312px; width:500px;"></div>
// Wistia Video Setup
window._wapiq = window._wapiq || [];
_wapiq.push(function(W) {
window.wistiaUploader = new W.Uploader({
accessToken: "{{wistia_access_token}}",
dropIn: "wistia-upload-widget",
projectId: "{{wistia_project_id}}"
});
wistiaUploader.bind("uploadstart", function(file) {
window.onbeforeunload = confirmLeaveBeforeUpload;
console.log("Upload has began: ", file);
});
wistiaUploader.bind('uploadsuccess', function(file, media) {
console.log("Upload succeeded.");
$.ajax({
type: "POST",
url: '{% url 'video:create' %}',
data: {key: media.id},
success: function (res) {
window.onbeforeunload = confirmLeaveBeforePublish;
$('#upload-init').addClass('hide');
$('#video').val(res.data.pk);
$('#video-thumbnail').addClass('hide');
$('#uploaded-video').removeClass('hide');
},
});
});
wistiaUploader.bind('uploadembeddable', function(file, media, embedCode, oembedResponse) {
console.log("Embeddable:", media);
});
wistiaUploader.bind("uploadfailed", function(file, errorResponse) {
console.log("Upload failed:", errorResponse.error);
alert("Unfortunately, your video failed to upload. Please give this information to support: " + errorResponse.error);
window.onbeforeunload = null;
});
});
注意:访问令牌和 project_id 来自 django 并正确放置。
看起来这是 Wistia 端的一个问题,因为根据他们的支持进行了更新。问题总是出现在他们的 api.js 文件中。现在可以使用了。
我正在使用 Wistia API 上传视频。根据 Wistia 文档,代码似乎没问题,但是当我上传文件时,它显示进度从 0% 到 100%,但在达到 100% 后,哨兵在控制台中记录了以下错误:
Uncaught TypeError: this.wRemoteRequestor.post is not a function
此错误指向位于 https://fast.wistia.com/assets/external/api.js 的以下行的 wistia js 文件:
this.wRemoteRequestor.post(i, {
dataType: "json",
success: function(e) {
r.transformToCreateMediaResponse(e),
e.data.originalUrl = "".concat(r.generateExtensionlessOriginalUrl(o), ".bin"),
r.wistiaUploader._onSuccessRaw(e)
},
error: function(e) {
r.wistiaUploader._onError(e)
}
})
代码如下:
<div id="wistia-upload-widget" style="height:312px; width:500px;"></div>
// Wistia Video Setup
window._wapiq = window._wapiq || [];
_wapiq.push(function(W) {
window.wistiaUploader = new W.Uploader({
accessToken: "{{wistia_access_token}}",
dropIn: "wistia-upload-widget",
projectId: "{{wistia_project_id}}"
});
wistiaUploader.bind("uploadstart", function(file) {
window.onbeforeunload = confirmLeaveBeforeUpload;
console.log("Upload has began: ", file);
});
wistiaUploader.bind('uploadsuccess', function(file, media) {
console.log("Upload succeeded.");
$.ajax({
type: "POST",
url: '{% url 'video:create' %}',
data: {key: media.id},
success: function (res) {
window.onbeforeunload = confirmLeaveBeforePublish;
$('#upload-init').addClass('hide');
$('#video').val(res.data.pk);
$('#video-thumbnail').addClass('hide');
$('#uploaded-video').removeClass('hide');
},
});
});
wistiaUploader.bind('uploadembeddable', function(file, media, embedCode, oembedResponse) {
console.log("Embeddable:", media);
});
wistiaUploader.bind("uploadfailed", function(file, errorResponse) {
console.log("Upload failed:", errorResponse.error);
alert("Unfortunately, your video failed to upload. Please give this information to support: " + errorResponse.error);
window.onbeforeunload = null;
});
});
注意:访问令牌和 project_id 来自 django 并正确放置。
看起来这是 Wistia 端的一个问题,因为根据他们的支持进行了更新。问题总是出现在他们的 api.js 文件中。现在可以使用了。