上传视频成功之后,云平台上没有保存第一帧的截图

新手上路,请多包涵

已经提交成功视频文件至七牛云,后台接口人员也提供了获取帧截图的接口。 但是七牛云上没有保存帧截图,视频文件有保存
// 获取可以截取帧截图的token

  url = opt.apiHost + "/api/qiniu/qiniutoken/CreateVideoThumbUploadToken?bucket=" +
    opt.bucket + "&category=" +
    opt.category + "&persistentOps=vframe/jpg/offset/1/";
    
    
 var uploader = Qiniu.uploader({
      runtimes: 'html5,flash,html4',
      browse_button: fileButton,
      container: opt.container,
      drop_element: opt.container,
      max_file_size: opt.max_file_size,
      filters: {
        mime_types: [
          // {title: "Video files", extensions: "flv,mpg,mpeg,avi,wmv,mov,asf,rm,rmvb,mkv,m4v,mp4"}, // 限定flv,mpg,mpeg,avi,wmv,mov,asf,rm,rmvb,mkv,m4v,mp4后缀格式上传
          {title: "Video files", extensions: "flv,mpg,mpeg,avi,mov,asf,rm,rmvb,mkv,m4v,mp4"}, // 限定flv,mpg,mpeg,avi,wmv,mov,asf,rm,rmvb,mkv,m4v,mp4后缀格式上传
        ]
      },
      flash_swf_url: 'plupload/js/Moxie.swf',
      dragdrop: false,
      chunk_size: '4mb',
      multi_selection: true,
      uptoken: qiniuToken,
      domain: localStorage.getItem("qzsq_qiniu_private_domain"),
      get_new_uptoken: opt.get_new_uptoken,
      // downtoken_url: '/downtoken',
      unique_names: true,
      auto_start: opt.auto_start,
      log_level: 5,
      category: opt.category,
      init: {
        'FilesAdded': function (up, files) {
          $('#' + opt.quetable).show();
          console.log('目前待上传的队列文件=' + files);
          // console.log('还没删除前',up);
          // $('#' + opt.progressId).html("");
          // console.log("使用七牛sdk上传文件列表", files);
          var that = this;
          plupload.each(files, function (file) {
            var progress = new FileProgressNew(file, opt.progressId);
            progress.setStatus("等待上传...");
            progress.bindUploadCancel(up);
          });
          // 隐藏选择文件按钮
          $("#" + opt.container).hide();
          // 添加更多按钮显示
          var addMore = $("#quetable").find(".add-more");
          addMore.show();
          // 删除视频
          plupload.each(files, function (file, index) {
            $("#span_" + file.id).on("click", function () {
              delVideo(file.id);
            });
          });

          function delVideo(fileId) {
            for (var i = 0; i < files.length; i++) {
              if (files[i].id === fileId) {
                $("#span_" + fileId).parent().remove();
                up.removeFile(files[i]);
                files.splice(i, 1);
              }
            }
            // console.log('删除完之后文件队列', files);
          }

          // 手动触发上传
          $("#onStart").show().bind("click", function () {
            console.log('删除之后', up);
            up.start();
            addMore.css('cursor', 'not-allowed').attr("disabled", "disabled");
            $("#stopUpload").show();
            $(this).hide();

            // 再次生成fileName
            // var url = opt.apiHost + "/api/qiniu/qiniutoken/CreateVideoThumbUploadToken?bucket=" +
            //   opt.bucket + "&category=" +
            //   opt.category;
            // $.ajax({
            //   url: url,
            //   async: false,
            //   headers: {"Authorization": xmzyToken},
            //   success: function (data) {
            //     alert(data.result.fileNames);
            //     console.log(data.result.fileNames);
            //   }
            // });
          });

          // 取消发布
          $("#stopUpload").on("click", function () {
            up.stop();
            $(this).hide();
            $("#onStart").show();
            addMore.css('cursor', 'pointer').removeAttr("disabled");
          });
        },
        'BeforeUpload': function (up, file) {
          var progress = new FileProgressNew(file, opt.progressId);
          var chunk_size = plupload.parseSize(this.getOption('chunk_size'));
          if (up.runtime === 'html5' && chunk_size) {
            progress.setChunkProgess(chunk_size);
          }
        },
        'UploadProgress': function (up, file) {
          var progress = new FileProgressNew(file, opt.progressId);
          var chunk_size = plupload.parseSize(this.getOption('chunk_size'));
          progress.setProgress(file.percent + "%", file.speed, chunk_size);

        },
        'UploadComplete': function () {

        },
        'FileUploaded': function (up, file, info) {
          // var progress = new FileProgressNew(file, opt.progressId);
          console.log('上传成功之后返回值=' + info);
          var jsonData = $.parseJSON(info);
          opt.onUploaded.call(this, jsonData.key);
        },
        'Error': function (up, err, errTip) {
          $('#' + opt.quetable).show();
          var progress = new FileProgressNew(err.file, opt.progressId);
          progress.setError();
          progress.setStatus(errTip);
        }
      }
});
阅读 1.9k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
七牛云问答
子站问答
访问
宣传栏