Skip to main content

Processing

We support three different types of processing:

  1. sync Will process the video on our servers, and will return the processed video
  2. async Will process the video on our servers, and the processed video will be sent to a webhook you provide
  3. client Will process the video in the browser, using the power of W A S M
note

client side processing is made possible through a relatively new technology, we're still ironing out the kinks!

Sync Processing#

This will process the video on our servers, wait for it to complete, and finally return the output as a Uint8Array

const processedFile = await modfy.operation(...args, 'sync') // Will return a Unit8Array

Async Processing#

This will process the video on our server, but it won't wait for it to complete. Instead, a UUID is immediately returned that you can use to subscribe to get progress updates.

For this method, you will have to setup a webhookUrl. Checkout setting up a webhook receiver

const {uuid} = await modfy.operation(...args, 'async', 'yourdomain.com/callback')

When the final video is ready, you'll receive a notification via webhook containing the download URL.

Webhook Response#

The response will contain the following:

{
"uuid": "b073ef10-b9db-45e6-b7b4-32b5503ab79f", // Unique id of video
"url" : "https://download/url", // Download URL
"status" : {
code: 200,
message: "Success!"
}, // Should be success if the video was processed sucessfully
}

Retrieving a video#

You can directly download the video from the url or use a uuid to retrieve it:

// Get a download URL
const url = modfy.retrieve(uuid, 'url')
// Download the video as an ArrayBuffer
const buffer = modfy.retrieve(uuid, 'arraybuffer')
// Get the video as a Node.JS Stream
const stream = modfy.retrieve(uuid, 'stream')

Client-side Processing#

Setting up client-side processing is simple, and it starts with...

  1. Addding clientSide : true when Modfy is intialized

  2. Making sure SharedArrayBuffer is supported on the browsers you are using

    To enable support for firefox, you will need to add a few Headers

    Follow Enable Shared Array Buffer or reach out to [email protected] for help

  3. Using client as the type parameter when using any operation

Default Browser Support#

Default Browser Support

Client Side Caveats#

  • Unfortunately this will only work in browsers that do support SharedArrayBuffer

    We are working on an intelligent mode for the api, where it will automatically switch to server mode as needed.

  • Client Side Rendering has a file size limit of between 2-4gb. We're working on this!