Я генерирую тег ввода с помощью Java для загрузки видео прямо из браузера с помощью Cloudinary API, который отлично работает с небольшими видео, но не работает с 50 МБ.
Это код, генерирующий тег ввода:
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();
}
});
Возможно, мне чего-то не хватает, чего я не смог найти. Есть еще немного кода, касающегося процесса загрузки и результата, но я думаю, что проблема возникает раньше, среди кода, который я прикрепил к этому вопросу.