【发布时间】:2019-06-18 15:09:43
【问题描述】:
我正在使用 Java 生成一个输入标签,以便直接从浏览器上传视频,使用 Cloudinary API,它适用于小视频,但不适用于 50 MB 的视频。
这是生成输入标签的代码:
String html = cloudinary.uploader().imageUploadTag("file", options, htmlOptions);
Map options = ObjectUtils.asMap("resource_type", "video");
options.put("callback", "/cloudinary_cors.html");
options.put("eager", eager);
options.put("eager_async", true);
options.put("tags", videoTags);
options.put("use_filename", true);
Map htmlOptions = ObjectUtils.asMap();
htmlOptions.put("id", "videoInput");
htmlOptions.put("class", "upload");
这是生成的输入标签的示例:
<input type="file" name="file"
data-url="https://api.cloudinary.com/v1_1/rentalwebs/video/upload"
data-form-data="{"eager":"c_scale,h_720,w_1280","signature":"xxxfb0c461dxxx",
"api_key":"xxx1647231xxx","eager_async":true,
"callback":"/cloudinary_cors.html","tags":"Demo Website,1,Villa Demo 2",
"use_filename":true,"timestamp":"1548357724"}"
data-cloudinary-field="file" class="cloudinary-fileupload upload" id="videoInput">
最后,这些是附加到带有输入标签的页面的 .js 脚本:
<script th:src="@{/js/jquery.ui.widget.js}" type='text/javascript'></script>
<script th:src="@{/js/load-image.all.min.js}" type='text/javascript'></script>
<script th:src="@{/js/canvas-to-blob.min.js}" type='text/javascript'></script>
<script th:src="@{/js/jquery.iframe-transport.js}" type='text/javascript'></script>
<script th:src="@{/js/jquery.fileupload.js}" type='text/javascript'></script>
<script th:src="@{/js/jquery.fileupload-process.js}" type='text/javascript'></script>
<script th:src="@{/js/jquery.fileupload-image.js}" type='text/javascript'></script>
<script th:src="@{/js/jquery.fileupload-validate.js}" type='text/javascript'></script>
<script th:src="@{/js/jquery.cloudinary.js}" type='text/javascript'></script>
$(document).ready(function() {
if($.fn.cloudinary_fileupload !== undefined) {
$("input.cloudinary-fileupload[type=file]").cloudinary_fileupload();
}
});
我可能遗漏了一些我一直找不到的东西。还有一些代码,处理上传过程和结果,但我想问题发生在之前,在我附在这个问题上的代码中。
【问题讨论】:
-
您能分享一下您从 Cloudinary 收到的错误消息吗?
-
在浏览器端它没有给出任何错误信息,或者至少我没有找到它。我有一个从视频中获取预览图像的代码,并且在图像出现在屏幕上之后,什么也没有发生。我已经在没有预览图像代码的情况下对其进行了测试,结果相同。我猜上传过程,永远不会从那些大视频开始。
标签: cloudinary