cocoKnight 9dae144089 first commit 1 månad sedan
..
src 9dae144089 first commit 1 månad sedan
LICENSE 9dae144089 first commit 1 månad sedan
README.en.md 9dae144089 first commit 1 månad sedan
README.md 9dae144089 first commit 1 månad sedan
package.json 9dae144089 first commit 1 månad sedan
tsconfig.json 9dae144089 first commit 1 månad sedan

README.en.md

@file-viewer/renderer-media

Standalone audio and video renderer package for Flyfish File Viewer. It previews audio files, videos, HLS playlists, and MIDI files in the browser while loading hls.js and @tonejs/midi only for the formats that need them.

Usage

import { mediaRenderer } from '@file-viewer/renderer-media'

const options = {
  builtinRenderers: 'none',
  renderers: [mediaRenderer],
}

Or compose it through the full preset:

import { allRenderers } from '@file-viewer/preset-all'

const options = {
  builtinRenderers: 'none',
  renderers: allRenderers,
}

Features

  • MP4, WebM, and common audio formats use native browser <video> / <audio> controls first.
  • HLS .m3u8 uses native playback when available and dynamically imports hls.js only as a fallback.
  • MIDI / MID dynamically imports @tonejs/midi only when opened, then renders name, duration, PPQ, tracks, and note summaries.
  • Unmount cleanup revokes object URLs, resets media elements, and destroys the HLS instance for long-lived business applications.

Migration Note

@file-viewer/core no longer bundles media renderers and no longer depends directly on hls.js or @tonejs/midi. Install this package explicitly for audio, video, HLS, or MIDI preview, or use @file-viewer/preset-all, which aggregates this renderer automatically.