Forum Academy Marketplace Showcase Pricing Features

context.uploadContent() not returning URL or ERR on safari

I am using the following code to upload a base64 string of an mp4 video. I can print the string to the console and this code works in Chrome but when I run this in safari, context.uploadContent does not return a URL or err.

I only ever see starting upload and finish. I don’t see the items in the callback function

Any thoughts or follow up questions?

function(instance, properties, context) {


  var reader = new FileReader();
  reader.readAsDataURL(instance.data.recordedBlobs[0]);
  reader.onloadend = function() {
    var base64String = reader.result;

    let string = base64String.split(',')[2]

    console.log('starting upload')

    context.uploadContent('video.mp4', string, function(err, url) {
        console.log('in upload handler')
      if (err) {
        console.log(err)
      } else {
        console.log('success')
        console.log(url)
      }
    })
	console.log('finish')
  }
  
}

I don’t know if it’s your issue, but it appears you’re using the legacy file uploader, which has a file size limit of around 50 MB. And of course, base64 conversion bloats the file size (due to the binary to text conversion).

You might be better off using the new uploader, which was announced a couple years ago.

1 Like

I’m only working with 5 second video clips. def not too big. I just learned that FileReader is not available on safari. I’ll try using this, thanks @sudsy! I’ll come back with updates