IKHSAN
ENID Baca dalam Bahasa Indonesia

snapme

Public
Branch
master
Latest commit
130fdb828 October 2026

mediaSupport.ts

Open raw
"use client"

import type { LiveKind } from "@/lib/schemas"

/* SH-03: deteksi kemampuan perekam. Urutan kandidat mengutamakan WebM/VP9,
   lalu WebM, lalu MP4 (Safari). `null` berarti tombol versi hidup
   disembunyikan; tidak ada perekaman yang dipaksakan. */

const CANDIDATES: { mimeType: string; kind: LiveKind }[] = [
  { mimeType: "video/webm;codecs=vp9", kind: "webm" },
  { mimeType: "video/webm", kind: "webm" },
  { mimeType: "video/mp4", kind: "mp4" },
]

export function pickLiveKind(): LiveKind | null {
  if (typeof MediaRecorder === "undefined") {
    return null
  }
  return (
    CANDIDATES.find((candidate) =>
      MediaRecorder.isTypeSupported(candidate.mimeType)
    )?.kind ?? null
  )
}
bytes
712
lines
25
Type
ts
Latest commit
28 October 2026