The MediaConnectorController is responsible for all communication regarding media connectors. Methods inside this controller can be called by window.SDK.mediaConnector.{method-name}

The way GraFx Studio handles different sources of media is called 'MediaConnector'. A MediaConnector is an implementation of a set of capabilities we need to interact with a certain Digital Asset Management system. In essence, a connector is the combination of a JavaScript snippet and some metadata. The JavaScript snippet is loaded in the studio engine using a sandboxed JavaScript execution engine (QuickJs). This allows us to execute the media connector both on web using webassembly and on the server side during e.g. animation output generation. This controller is an interface to the running connector instance inside the studio engine.

Methods

  • The combination of a connectorId and mediaId is typically enough for a media connector to perform the download of this asset. The download endpoint is capable of relaying this information to the media connector instance running in the editor engine.

    Parameters

    • id: string

      unique id of the media connector

    • mediaId: string

      unique id of the media to download

    • downloadType: MediaDownloadType

      hint to the media connector about desired quality of the downloaded media

    • context: MetaData = {}

      context that will be available in the connector script.

    Returns Promise<Uint8Array<ArrayBufferLike>>

  • Invokes the upload on the connector, using the given staged pointer(s). If you want help with staging files, use the stageFiles method from the UtilsController.

    Parameters

    • connectorId: string

      The MediaConnector instance to use (just like download API).

    • filePointers: FilePointer[]

      Array of FilePointer as staged by stageFile(s).

    • context: MetaData = {}

      Arbitrary metadata/context for the upload (auth, meta fields, etc).

    Returns Promise<EditorResponse<Media[]>>

    Promise<Media[]>