7 Replies Latest reply on Jul 12, 2017 8:10 AM by Bruce Bullis

    How to upload media file?

    niravm14972017

      Hello,

       

      I would like to upload media file in s3 using Premiere Pro. extension.

      For that, I have created one  Premiere Pro. extension.

       

      I have used below code to upload media.

       

      uploadOnS3 = function (data) {
      
      
          console.log('uploadOnS3 called');
          var AWS = require('aws-sdk');
      
      
          AWS.config.update({
                accessKeyId: "XXX",
                secretAccessKey: "XXX"
          });
          var s3 = new AWS.S3();
      
      
          var bucketName = 'flex-qa3';
          var keyName = 'AA.mp4';
      
      
          var params = {Bucket: bucketName, Key: keyName, Body: data};
          var options = {partSize: 10 * 1024 * 1024, queueSize: 1};
          s3.upload(params, options, function(err, data) {
            console.log(err, data);
          });
      }
      
      uploadFile = function () {
          console.log('uploadFile called');
          var fsModule = 'fs';
          var fs = require(fsModule);
      
      
          // First I want to read the file
          fs.readFile("D:/Projects/AA.mp4", function read(err, data) {
                uploadOnS3(data);
           });
      }
      uploadFile();
      

       

      I have added node js support in manifest.xml file in extension and I am using 'aws-sdk' for s3 upload.

       

      <CEFCommandLine>
         <Parameter>--enable-nodejs</Parameter>
         <Parameter>--mixed-context</Parameter>
      </CEFCommandLine>
      
                              
                

       

       

      I can upload this file successfully on s3 but when I download this file and open with media player.

      It couldn't play and it is corrupted.

       

      Same code when I run with directly by node application without Premiere Pro. then it works and media file doesn't corrupt.

       

      Same way when I download the file using 'FS' module in premiere pro then file corrupted and couldn't open in media player.

      The Same code works outside the Premiere Pro. well.

       

      Could you provide the proper way to upload and download media file?

      Do I need to use any encoding type?

      Are there any specific changes in Premiere Pro related to Buffer API and read/write related API?

       

       

      Premier Pro. Version: 11.0