hcengineering/platform · error

Recorder: video recording is not supported

Error message

Recorder: video recording is not supported

What it means

The Recorder constructor probes the browser via getSupportedMimeTypes() (checking MediaRecorder.isTypeSupported) for a video container/codec the current engine can record. If none is supported it throws before constructing the MediaRecorder, because recording cannot proceed without a viable mimeType. This is an upfront capability check, not a runtime recording failure.

Source

Thrown at plugins/recorder-resources/src/recorder.ts:44

}

export class Recorder {
  readonly mimeType: string
  private readonly mediaRecorder: MediaRecorder
  private readonly chunkStream: ChunkReader
  private readonly chunkInterval: number
  // Total elapsed recording time in milliseconds (excluding pauses)
  private elapsedMs: number = 0
  // Timestamp when recording or resuming started; null if paused or not started
  private lastStartTime: number | null = null

  constructor (
    private readonly mediaStream: MediaStream,
    readonly options: RecorderOptions
  ) {
    const supportedTypes = getSupportedMimeTypes()
    if (supportedTypes.length === 0) {
      throw new Error('Recorder: video recording is not supported')
    }

    this.mimeType = supportedTypes[0]
    this.chunkInterval = options.chunkIntervalMs ?? chunkIntervalMs
    this.chunkStream = new ChunkReader()

    this.mediaRecorder = new MediaRecorder(mediaStream, {
      mimeType: this.mimeType,
      audioBitsPerSecond: options.audioBps,
      videoBitsPerSecond: options.videoBps
    })

    console.debug('Recorder: MediaRecorder using', this.mimeType)

    this.mediaRecorder.ondataavailable = async (e) => {
      const kb = Math.floor(e.data.size / 1024)
      console.debug('Recorder: MediaRecorder data available', formatElapsedTime(e.timecode), `${kb}KB`)
      this.chunkStream.push(e.data)

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Feature-detect before constructing: check typeof MediaRecorder !== 'undefined' and that some expected mimeType is supported; show a 'recording not supported' UI state instead of crashing.
  2. Use an up-to-date Chromium/Firefox/Safari version with MediaRecorder video codec support.
  3. Serve the app over HTTPS (secure context) so media APIs are fully enabled.
  4. In unsupported environments, fall back to screen-capture/extension-based recording or an external recording service.

Example fix

// before
const recorder = new Recorder(mediaStream, options) // throws if unsupported

// after
function recorderSupported(): boolean {
  return (
    typeof MediaRecorder !== 'undefined' &&
    getSupportedMimeTypes().length > 0
  )
}
if (!recorderSupported()) {
  ui.showRecordingUnsupportedMessage()
} else {
  const recorder = new Recorder(mediaStream, options)
}
Defensive patterns

Strategy: validation

Validate before calling

function canRecordVideo(): boolean {
  if (typeof MediaRecorder === 'undefined') return false
  const candidates = ['video/webm;codecs=vp9', 'video/webm;codecs=vp8', 'video/webm', 'video/mp4']
  return candidates.some((t) => MediaRecorder.isTypeSupported(t))
}
if (!canRecordVideo()) showRecordingUnsupportedNotice()

Type guard

function isRecorderSupported(): boolean {
  return typeof MediaRecorder !== 'undefined' && typeof MediaRecorder.isTypeSupported === 'function'
}

Try / catch

let recorder: Recorder | null = null
try {
  recorder = new Recorder(mediaStream, options)
} catch (err) {
  if (err instanceof Error && err.message === 'Recorder: video recording is not supported') {
    recorder = null
    ui.showUnsupportedBrowserDialog()
  } else {
    throw err
  }
}

Prevention

When it happens

Trigger: Constructing new Recorder(mediaStream, options) in a browser or context where no supported video MIME type exists: MediaRecorder API missing or isTypeSupported returns false for all candidates (e.g. unsupported browsers like older Safari/Firefox without codecs, webviews with MediaRecorder stubbed out, secure-context issues).

Common situations: Older Safari/iOS webviews lacking MediaRecorder video support; non-HTTPS pages where some APIs are restricted; headless/embedded browsers without codec licenses (no H.264/VP8); enterprise browsers with media APIs disabled by policy.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/60baabc7285e7d20. Report an issue: GitHub.