я использую возобновляемый JS для загрузки видео на JWPlayer в laravel wepapp - PullRequest
0 голосов
/ 14 октября 2019

Я использую возобновляемую js для загрузки видео на JWPlayer в laravel wepapp. когда я загружаю видео. он загружает только первую порцию видео на панель инструментов jwp, а затем возвращает ошибку ниже на вкладке сети.

a:4:{s:6:"status";s:5:"error";s:7:"message";s:72:"Uploads for the media files with the status `processing` are not allowed";s:4:"code";s:16:"PermissionDenied";s:5:"title";s:17:"Permission Denied";}

, так как последние два я ищу решение. см. ниже мой возобновляемый код JS. я передал 1 МБ чанк на сервер jwp для хранения. но после первой порции он говорит: «Загрузка файлов мультимедиа со статусом processing не разрешена», как я уже упоминал выше в полном сообщении об ошибке.

var $ = window.$; // use the global jQuery instance

var $fileUpload = $('#resumable-browse');
var $fileUploadDrop = $('#resumable-drop');
var $uploadList = $("#file-upload-list");

if ($fileUpload.length > 0 && $fileUploadDrop.length > 0) {
    console.log($fileUpload.data('url'));
  var resumable = new Resumable({
    // Use chunk size that is smaller than your maximum limit due a resumable issue
    // https://github.com/23/resumable.js/issues/51
    chunkSize: 1 * 1024 * 1024,
    // 1MB
    method: "POST",
    simultaneousUploads: 1,
    testChunks: false,
    throttleProgressCallbacks: 1,
    // Get the url from data-url tag
    target: $fileUpload.data('url'),
     headers: {
       "X-Session-Id":$("#jwToken").val(),
    },
    // Append token to the request - required for web routes

    query: {
      _token: $('input[name=_token]').val()
    }
  }); // Resumable.js isn't supported, fall back on a different method

  if (!resumable.support) {
    $('#resumable-error').show();
  } else {
    // Show a place for dropping/selecting files
    $fileUploadDrop.show();
    resumable.assignDrop($fileUpload[0]);
    resumable.assignBrowse($fileUploadDrop[0]); // Handle file add event

    resumable.on('fileAdded', function (file) {
      // Show progress pabr
      $uploadList.show(); // Show pause, hide resume

      $('.resumable-progress .progress-resume-link').hide();
      $('.resumable-progress .progress-pause-link').show(); // Add the file to the list

      $uploadList.append('<li class="resumable-file-' + file.uniqueIdentifier + '">Processing <span class="resumable-file-name"></span> <span class="resumable-file-progress"></span>');
      $('.resumable-file-' + file.uniqueIdentifier + ' .resumable-file-name').html(file.fileName); // Actually start the upload

      resumable.upload();
    });
    resumable.on('fileSuccess', function (file, message) {
      // Reflect that the file upload has completed
      $('.resumable-file-' + file.uniqueIdentifier + ' .resumable-file-progress').html('(completed)');
    });
    resumable.on('fileError', function (file, message) {
      // Reflect that the file upload has resulted in error
      $('.resumable-file-' + file.uniqueIdentifier + ' .resumable-file-progress').html('(file could not be uploaded: ' + message + ')');
    });
    resumable.on('fileProgress', function (file) {
      // Handle progress for both the file and the overall upload
      $('.resumable-file-' + file.uniqueIdentifier + ' .resumable-file-progress').html(Math.floor(file.progress() * 100) + '%');
      $('.progress-bar').css({
        width: Math.floor(resumable.progress() * 100) + '%'
      });
    });
  }
}

/***/ }),

1 Ответ

1 голос
/ 21 октября 2019

Я бы удостоверился, что при создании видео вы указали multipart метод загрузки .

Также убедитесь, что местоположение, в которое вы пытаетесь загрузить, является темвозвращается в вызове создания (он должен идти к конечной точке /v1/videos/upload/resumable). Это руководство должно содержать более подробную информацию о процессе.

...