TheOpenPresenter
  • Introduction
    • Welcome
    • Motivation & Challenges
    • System Architecture
    • Terminologies
    • Server Communication
    • Project Topology
  • Development
    • Quickstart
    • Static files
    • Media Storage
  • Plugins
    • Introduction
    • Official Plugins
      • Google Slides
      • Lyrics Presenter
        • Lyrics compatibility
      • Video Player
      • Audio Recorder
    • Developing a Plugin
      • Plugin API
        • Yjs
          • Awareness
          • Scene
          • Renderer
        • Backend
          • Yjs Handler
          • Loading Frontend
          • Security
        • Frontend
          • Remote
          • Renderer
        • Media
          • Server Plugin API
          • Frontend
            • Tus
            • Form Data
        • TRPC
        • Database
      • Audio
      • Viewer State
      • Notifying Errors
      • Caveats
        • Sharing dependencies
        • Cross-over between plugins
      • Performance
  • API Reference
    • Plugin Context
  • Guide
    • Playing Audio
    • Listen to scene changes
  • Scratch Pad
    • Ambition
    • Background music
  • Environment Variables
  • External
    • Page 1
Powered by GitBook
On this page
  • Endpoint
  • Headers
  1. Plugins
  2. Developing a Plugin
  3. Plugin API
  4. Media
  5. Frontend

Form Data

PreviousTusNextTRPC

Last updated 6 months ago

Whenever possible, we recommend using the Tus endpoint instead.

Endpoint

The form-data endpoint can be obtained through the pluginApi:

pluginApi.media.formDataUploadUrl

Headers

In addition to the headers described in , we also require the following headers to be set:

upload-length

The size of the uploaded media/file.

Here's an example of including these data using Uppy:

new Uppy().use(XHR, {
  endpoint: pluginApi.media.formDataUploadUrl,
  headers: (file) => ({
    "csrf-token": appData.getCSRFToken(),
    "organization-id": pluginApi.pluginContext.organizationId,
    ...(file.size
      ? {
          "upload-length": file.size.toString(),
        }
      : {}),
  }),
})

Frontend