Fire Player documentation

Reference, from mount to teardown.

This documentation follows the Fire Player 5.4.1 source and type definitions included with the current release.

00 / Overview

Fire Player in one minute

Fire Player mounts to a container, owns an HTML video element, exposes player state through properties and methods, and accepts optional plugin factories. The browser build exposes window.FirePlayer. The ESM build exports the class as default.

Version: Core v5.4.1. Product identity and canonical domain are Fire Player and fireplayer.net.
Minimal browser setup
<div id="player"></div>
<script src="/vendor/fireplayer.js"></script>
<script>
const fire = new FirePlayer({
  container: '#player',
  url: '/media/video.mp4'
})
</script>
01 / Start

Getting started

Browser build

Download the browser release and serve fireplayer.js from your own origin.

HTML
<div id="player" style="width:100%;aspect-ratio:16/9"></div>
<script src="/assets/fireplayer/fireplayer.js"></script>
<script>
const fire = new FirePlayer({
  container: '#player',
  url: '/media/video.mp4',
  theme: '#ff1708',
  setting: true,
  playbackRate: true,
  fullscreen: true
})
</script>

ES module

JavaScript
import FirePlayer from './vendor/fireplayer/fireplayer.mjs'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/video.mp4'
})

If Fire Player is published to your own package registry under fireplayer, the same default import applies.

02 / Streaming

HLS and DASH

Adaptive streaming engines are intentionally attached through customType. This keeps the core independent of a specific HLS or DASH runtime.

HLS

JavaScript
const fire = new FirePlayer({
  container: '#player',
  url: '/live/master.m3u8',
  type: 'm3u8',
  customType: {
    m3u8(video, url, fire) {
      const hls = new Hls()
      hls.loadSource(url)
      hls.attachMedia(video)
      fire.hls = hls
      fire.once('destroy', () => hls.destroy())
    }
  }
})

DASH

JavaScript
const fire = new FirePlayer({
  container: '#player',
  url: '/dash/manifest.mpd',
  type: 'mpd',
  customType: {
    mpd(video, url, fire) {
      const dash = dashjs.MediaPlayer().create()
      dash.initialize(video, url, false)
      fire.mpd = dash
      fire.once('destroy', () => dash.destroy())
    }
  }
})

Use fireplayer-plugin-hls-control or fireplayer-plugin-dash-control when you want engine-aware quality and audio selectors.

03 / Types

TypeScript

The release includes types/fireplayer.d.ts plus typed option, event, component, setting, subtitle, quality and utility definitions.

TypeScript
import FirePlayer, { type Option } from 'fireplayer'

const option: Option = {
  container: '#player',
  url: '/video.mp4',
  fullscreen: true
}

const fire = new FirePlayer(option)
04 / Core API

Constructor options

container and url are the only required options. The remaining features are opt-in or resolved by the core.

OptionTypeDefaultPurpose
idstringLogical player id.
containerstring | HTMLDivElementrequiredMount target.
urlstringrequiredVideo or stream URL.
posterstringPoster image URL.
typeCustomTypeautoMedia type: flv, m3u8, hls, ts, mpd, torrent or custom.
themestringPrimary player theme color.
langI18n keyPlayer interface language.
volumenumberInitial volume.
isLivebooleanfalseLive broadcast mode.
mutedbooleanfalseStart muted.
autoplaybooleanfalseRequest autoplay.
autoSizebooleanfalseResize player to video.
autoMinibooleanfalseAutomatically enter mini mode.
loopbooleanfalseLoop playback.
flipbooleanfalseExpose flip controls.
playbackRatebooleanfalseExpose playback-rate controls.
aspectRatiobooleanfalseExpose aspect-ratio controls.
screenshotbooleanfalseExpose screenshot control.
settingbooleanfalseExpose settings panel.
hotkeybooleanfalseEnable keyboard controls.
pipbooleanfalseExpose picture-in-picture.
mutexbooleanfalseAllow one active player at a time.
backdropbooleanfalseEnable UI backdrop.
fullscreenbooleanfalseExpose native fullscreen.
fullscreenWebbooleanfalseExpose web fullscreen.
subtitleOffsetbooleanfalseEnable subtitle timing offset.
miniProgressBarbooleanfalseShow compact progress while controls are hidden.
useSSRbooleanfalseEnable SSR-oriented behavior.
playsInlinebooleanfalseUse inline playback on mobile.
lockbooleanfalseEnable mobile lock mode.
gesturebooleanfalseEnable mobile gestures.
fastForwardbooleanfalseEnable mobile fast-forward behavior.
autoPlaybackbooleanfalseEnable automatic playback continuation behavior.
autoOrientationbooleanfalseEnable mobile orientation handling.
airplaybooleanfalseExpose AirPlay.
proxyfunctionProvide a custom video/canvas proxy.
pluginsfunction[][]Plugin factories.
layersComponentOption[][]Custom overlay layers.
contextmenuComponentOption[][]Custom context-menu entries.
controlsComponentOption[][]Custom control entries.
settingsSetting[][]Custom settings.
qualityQuality[][]Manual quality variants.
highlight{{time,text}}[][]Timeline highlights.
thumbnailsThumbnailsTimeline thumbnail sprite configuration.
subtitleSubtitleSubtitle source and styling.
moreVideoAttrobjectAdditional HTMLVideoElement properties.
i18nI18nCustom translations.
iconsobjectCustom icon markup.
cssVarobjectPlayer CSS variable overrides.
customTypeRecordCustom media type handlers.
05 / Core API

Player properties

Most playback state is exposed as direct JavaScript properties. Setters update the underlying player immediately.

PropertyAccessPurpose
urlget / setCurrent media URL.
currentTimeget / setPlayback position in seconds.
durationgetMedia duration.
playedgetPlayed progress.
playinggetWhether playback is active.
volumeget / setVolume level.
mutedget / setMute state.
playbackRateget / setPlayback speed.
aspectRatioget / setCurrent aspect ratio.
flipget / setVideo flip mode.
fullscreenget / setNative fullscreen state.
fullscreenWebget / setWeb fullscreen state.
pipget / setPicture-in-picture state.
miniget / setMini-player state.
posterget / setPoster URL.
themeget / setTheme color.
stateget / setstandard, mini, pip, fullscreen or fullscreenWeb.
qualityget / setQuality source list.
subtitleOffsetget / setSubtitle time offset.
thumbnailsget / setTimeline thumbnail configuration.
videogetUnderlying HTMLVideoElement.
optiongetResolved player options.
pluginsgetPlugin registry and dynamic add API.
storagegetFire Player local settings storage interface.
06 / Core API

Methods

MethodReturnPurpose
play()PromiseStart playback.
pause()voidPause playback.
toggle()voidToggle play/pause.
switchUrl(url)PromiseSwitch media source.
switchQuality(url)PromiseSwitch quality source.
screenshot(name?)PromiseCapture and optionally download a frame.
getDataURL()PromiseReturn the current frame as a data URL.
getBlobUrl()PromiseReturn the current frame as a blob URL.
airplay()voidOpen AirPlay when supported.
autoSize()voidResize to media dimensions.
autoHeight()voidRecalculate height.
reset()voidReset player state.
destroy(removeHtml?)voidDestroy the Fire Player instance.
on(name, fn)thisSubscribe to an event.
once(name, fn)thisSubscribe once.
off(name, fn?)thisRemove event listeners.
emit(name, ...args)thisEmit an event.
attr(key, value?)unknownRead or write a video attribute.
cssVar(key, value?)CssVar valueRead or write a Fire Player CSS variable.
Lifecycle
fire.on('ready', () => fire.play())
fire.seek = 42
fire.volume = 0.6
await fire.switchUrl('/next-video.mp4')
fire.destroy()
07 / Core API

Events

Use on, once and off. Fire Player also proxies native video events under the video: prefix.

readydestroyplaypauserestarterrorseekmutedfullscreenfullscreenErrorfullscreenWebminipipscreenshotkeydownhotkeyresizeviewlockaspectRatioautoHeightautoSizeairplayraffocusblurclickdblclickhovermousemoveinfolayerloadingmasksubtitlecontextmenucontrolsettingsubtitleOffsetsubtitleBeforeUpdatesubtitleAfterUpdatesubtitleLoadsetBarflipdocument:clickdocument:mouseupdocument:keydowndocument:touchenddocument:touchmovedocument:mousemovedocument:pointerupdocument:contextmenudocument:pointermovedocument:visibilitychangedocument:webkitfullscreenchangewindow:resizewindow:scrollwindow:orientationchangevideo:abortvideo:canplayvideo:canplaythroughvideo:completevideo:durationchangevideo:emptiedvideo:encryptedvideo:endedvideo:errorvideo:loadeddatavideo:loadedmetadatavideo:loadstartvideo:pausevideo:playvideo:playingvideo:progressvideo:ratechangevideo:seekedvideo:seekingvideo:stalledvideo:suspendvideo:timeupdatevideo:volumechangevideo:waiting
JavaScript
fire.on('ready', () => {})
fire.on('video:timeupdate', event => {})
fire.on('fullscreen', state => {})
fire.on('error', (error, reconnectTime) => {})
08 / Interface

Subtitles

The built-in subtitle option accepts VTT, SRT, ASS or a custom type string. You can switch tracks at runtime and style the active subtitle layer.

JavaScript
const fire = new FirePlayer({
  container: '#player',
  url: '/video.mp4',
  subtitle: {
    url: '/subtitles/tr.vtt',
    type: 'vtt',
    style: { fontSize: '20px' }
  }
})

await fire.subtitle.switch('/subtitles/en.srt', { type: 'srt' })
fire.subtitleOffset = 0.25
09 / Interface

Manual quality lists

For direct-file variants, provide a quality array. Each item contains display HTML/text and a URL.

JavaScript
quality: [
  { html: '1080p', url: '/video-1080.mp4', default: true },
  { html: '720p', url: '/video-720.mp4' }
]

For adaptive manifests, prefer the HLS or DASH control plugin so the selector tracks engine levels rather than hard-coded URLs.

10 / Interface

Controls, layers and context menu

All three surfaces use component options with names, ordering, HTML, styles and lifecycle callbacks.

Custom control
controls: [{
  name: 'bookmark',
  position: 'right',
  html: 'Save',
  click(component, event) {
    localStorage.setItem('resume', String(this.currentTime))
  }
}]

At runtime use fire.controls.add(), update() and remove(). The same component API exists on layers and contextmenu.

11 / Interface

Custom settings

Settings support selectors, switches and ranges. Use the callback this context to access the active Fire Player instance.

JavaScript
settings: [{
  html: 'Low latency',
  switch: true,
  onSwitch(item) {
    item.switch = !item.switch
    return item.switch
  }
}]
12 / Interface

Mobile behavior

Use playsInline, lock, gesture, fastForward and autoOrientation explicitly. Native autoplay and fullscreen restrictions still come from the browser and operating system.

Mobile profile
{
  playsInline: true,
  lock: true,
  gesture: true,
  fastForward: true,
  autoOrientation: true,
  fullscreen: true
}
13 / Extend

Plugin reference

The current Fire Player distribution includes 16 plugin packages. Every package below has a working configuration example and its relevant runtime API. Plugins are passed to the constructor through plugins or can be added through the plugin manager.

PackageVersionPurpose
fireplayer-plugin-adsv2.1.0Pre-roll HTML or video advertising with skip timing, click-through, mute/fullscreen controls and ad lifecycle events.
fireplayer-plugin-vastv1.2.0VAST/IMA advertising through Google IMA and @glomex/vast-ima-player. Supports ad-tag URLs and raw VAST responses.
fireplayer-plugin-hls-controlv1.1.0Adds HLS quality and audio selectors to controls and/or settings. Requires an HLS.js instance exposed as fire.hls.
fireplayer-plugin-dash-controlv1.1.0Adds DASH quality and audio selectors. Requires a dash.js instance exposed as fire.dash.
fireplayer-plugin-chromecastv1.1.0Adds Google Cast support and a Chromecast control.
fireplayer-plugin-multiple-subtitlesv1.2.0Loads multiple VTT, SRT or ASS subtitle sources and merges or switches tracks at runtime.
fireplayer-plugin-audio-trackv1.1.0Synchronizes an external audio file with the video element, useful for alternate dubbing or replacement audio.
fireplayer-plugin-chapterv1.1.0Segments the progress bar into chapters and shows chapter titles while seeking.
fireplayer-plugin-vtt-thumbnailv1.1.0Reads WebVTT thumbnail cues and renders sprite thumbnails on progress hover or mobile seek.
fireplayer-plugin-auto-thumbnailv1.1.0Generates a thumbnail sprite in the browser by seeking through the media and drawing frames to canvas.
fireplayer-plugin-document-pipv1.1.0Moves the complete player UI into Document Picture-in-Picture when supported, with video PiP fallback.
fireplayer-plugin-ambilightv1.1.0Creates a dynamic ambient-light effect around the player using sampled video frames.
fireplayer-plugin-asrv2.1.0Captures PCM/WAV audio chunks from playback for speech-to-text workflows and displays returned subtitles.
fireplayer-plugin-danmukuv5.3.0Danmuku/bullet-comment rendering with scrolling, top and bottom modes, filtering, emitter controls and heatmap support.
fireplayer-plugin-danmuku-maskv1.1.0Uses MediaPipe selfie segmentation to mask danmuku around foreground people.
fireplayer-plugin-jassubv1.1.0Renders ASS/SSA subtitles through JASSUB/libass with WebAssembly workers and custom fonts.
Engine plugins: HLS control and DASH control provide player UI; they do not bundle the streaming engine. Bind your HLS.js instance to fire.hls or your dash.js instance to fire.dash.
13.01 / Plugin

fireplayer-plugin-ads

Pre-roll HTML or video advertising with skip timing, click-through, mute/fullscreen controls and ad lifecycle events.

v2.1.0
Installnpm i fireplayer-plugin-ads

Key API: html · video · url · playDuration · totalDuration · muted · i18n

fireplayerPluginAds
import fireplayerPluginAds from 'fireplayer-plugin-ads'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginAds({
      video: '/ads/pre-roll.mp4',
      url: 'https://advertiser.example/campaign',
      playDuration: 5,
      totalDuration: 15,
      muted: false,
      i18n: {
        close: 'Close ad',
        countdown: '%s s',
        detail: 'Learn more',
        canBeClosed: 'Skip in %s s'
      }
    })
  ]
})

fire.on('fireplayerPluginAds:click', ad => console.log(ad))
fire.on('fireplayerPluginAds:skip', ad => console.log(ad))
Runtime API: v2.1.0 accepts html or video ad content. playDuration controls the unskippable period and totalDuration controls the complete ad duration. The returned plugin instance exposes skip(), pause() and play().
13.02 / Plugin

fireplayer-plugin-vast

VAST/IMA advertising through Google IMA and @glomex/vast-ima-player. Supports ad-tag URLs and raw VAST responses.

v1.2.0
Installnpm i fireplayer-plugin-vast

Key API: playUrl · playRes · init · ima · imaPlayer · adsRenderingSettings · playerOptions

fireplayerPluginVast
import fireplayerPluginVast from 'fireplayer-plugin-vast'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginVast(({ fire, playUrl }) => {
      fire.once('play', () => {
        playUrl('https://ads.example/vast.xml')
      })
    })
  ]
})
VAST requirements: the plugin loads Google IMA through @glomex/vast-ima-player. Ad blockers can block the IMA SDK or ad requests. The callback receives playUrl() for an ad-tag URL and playRes() for a raw VAST response.
13.03 / Plugin

fireplayer-plugin-hls-control

Adds HLS quality and audio selectors to controls and/or settings. Requires an HLS.js instance exposed as fire.hls.

v1.1.0
Installnpm i fireplayer-plugin-hls-control

Key API: quality · audio · control · setting · title · auto · getName · update

fireplayerPluginHlsControl
import Hls from 'hls.js'
import fireplayerPluginHlsControl from 'fireplayer-plugin-hls-control'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/master.m3u8',
  type: 'm3u8',
  setting: true,
  plugins: [
    fireplayerPluginHlsControl({
      quality: { control: true, setting: true, getName: level => `${level.height}P` },
      audio: { control: true, setting: true, getName: track => track.name }
    })
  ],
  customType: {
    m3u8(video, url, fire) {
      if (fire.hls) fire.hls.destroy()
      const hls = new Hls()
      hls.loadSource(url)
      hls.attachMedia(video)
      fire.hls = hls
      fire.once('destroy', () => hls.destroy())
    }
  }
})
Required binding: assign the active HLS.js instance to fire.hls. The control plugin reads levels and audio tracks from that instance and exposes update().
13.04 / Plugin

fireplayer-plugin-dash-control

Adds DASH quality and audio selectors. Requires a dash.js instance exposed as fire.dash.

v1.1.0
Installnpm i fireplayer-plugin-dash-control

Key API: quality · audio · control · setting · title · auto · getName · update

fireplayerPluginDashControl
import dashjs from 'dashjs'
import fireplayerPluginDashControl from 'fireplayer-plugin-dash-control'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/manifest.mpd',
  type: 'mpd',
  setting: true,
  plugins: [
    fireplayerPluginDashControl({
      quality: { control: true, setting: true, getName: level => `${level.height}P` },
      audio: { control: true, setting: true, getName: track => track.lang?.toUpperCase() }
    })
  ],
  customType: {
    mpd(video, url, fire) {
      if (fire.dash) fire.dash.destroy()
      const dash = dashjs.MediaPlayer().create()
      dash.initialize(video, url, false)
      fire.dash = dash
      fire.once('destroy', () => dash.destroy())
    }
  }
})
Required binding: assign the active dash.js instance to fire.dash. The plugin uses the DASH bitrate list, current quality and audio tracks to build selectors.
13.05 / Plugin

fireplayer-plugin-chromecast

Adds Google Cast support and a Chromecast control.

v1.1.0
Installnpm i fireplayer-plugin-chromecast

Key API: url · sdk · icon · mimeType

fireplayerPluginChromecast
import fireplayerPluginChromecast from 'fireplayer-plugin-chromecast'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginChromecast({
      mimeType: 'video/mp4'
    })
  ]
})
Options: override url, Cast sdk, control icon or mimeType when automatic detection is not suitable.
13.06 / Plugin

fireplayer-plugin-multiple-subtitles

Loads multiple VTT, SRT or ASS subtitle sources and merges or switches tracks at runtime.

v1.2.0
Installnpm i fireplayer-plugin-multiple-subtitles

Key API: subtitles · url · name · type · encoding · tracks · reset

fireplayerPluginMultipleSubtitles
import fireplayerPluginMultipleSubtitles from 'fireplayer-plugin-multiple-subtitles'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginMultipleSubtitles({
      subtitles: [
        { name: 'tr', url: '/subtitles/tr.srt', type: 'srt' },
        { name: 'en', url: '/subtitles/en.vtt', type: 'vtt' }
      ]
    })
  ]
})

fire.plugins.multipleSubtitles.tracks(['tr'])
fire.plugins.multipleSubtitles.reset()
Runtime controls: tracks(names) activates selected named tracks; reset() restores all configured tracks.
13.07 / Plugin

fireplayer-plugin-audio-track

Synchronizes an external audio file with the video element, useful for alternate dubbing or replacement audio.

v1.1.0
Installnpm i fireplayer-plugin-audio-track

Key API: url · offset · sync · audio · update

fireplayerPluginAudioTrack
import fireplayerPluginAudioTrack from 'fireplayer-plugin-audio-track'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginAudioTrack({
      url: '/audio/turkish.aac',
      offset: 0,
      sync: 0.3
    })
  ]
})

fire.plugins.fireplayerPluginAudioTrack.update({ offset: -0.15 })
Synchronization: offset is measured in seconds. Positive values make the external audio lead the video; negative values delay it. sync is the resynchronization threshold.
13.08 / Plugin

fireplayer-plugin-chapter

Segments the progress bar into chapters and shows chapter titles while seeking.

v1.1.0
Installnpm i fireplayer-plugin-chapter

Key API: chapters · start · end · title · update

fireplayerPluginChapter
import fireplayerPluginChapter from 'fireplayer-plugin-chapter'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginChapter({
      chapters: [
        { start: 0, end: 30, title: 'Intro' },
        { start: 30, end: 120, title: 'Main scene' },
        { start: 120, end: Infinity, title: 'Ending' }
      ]
    })
  ]
})
Validation: chapter ranges must be ordered, non-overlapping and inside the media duration. Infinity is accepted for the final chapter end and resolves to the video duration.
13.09 / Plugin

fireplayer-plugin-vtt-thumbnail

Reads WebVTT thumbnail cues and renders sprite thumbnails on progress hover or mobile seek.

v1.1.0
Installnpm i fireplayer-plugin-vtt-thumbnail

Key API: vtt · style

fireplayerPluginVttThumbnail
import fireplayerPluginVttThumbnail from 'fireplayer-plugin-vtt-thumbnail'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginVttThumbnail({
      vtt: '/thumbnails/movie.vtt'
    })
  ]
})
VTT input: provide a WebVTT file whose cues reference thumbnail images or sprite coordinates. style accepts CSSStyleDeclaration-compatible overrides for the thumbnail control.
13.10 / Plugin

fireplayer-plugin-auto-thumbnail

Generates a thumbnail sprite in the browser by seeking through the media and drawing frames to canvas.

v1.1.0
Installnpm i fireplayer-plugin-auto-thumbnail

Key API: url · width · number · scale

fireplayerPluginAutoThumbnail
import fireplayerPluginAutoThumbnail from 'fireplayer-plugin-auto-thumbnail'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginAutoThumbnail({
      width: 160,
      number: 80,
      scale: 1
    })
  ]
})
CORS: the plugin creates a cross-origin video and draws frames to canvas. Remote media must allow CORS or browser security will prevent thumbnail generation.
13.11 / Plugin

fireplayer-plugin-document-pip

Moves the complete player UI into Document Picture-in-Picture when supported, with video PiP fallback.

v1.1.0
Installnpm i fireplayer-plugin-document-pip

Key API: width · height · placeholder · fallbackToVideoPiP · open · close · toggle · isSupported · isActive

fireplayerPluginDocumentPip
import fireplayerPluginDocumentPip from 'fireplayer-plugin-document-pip'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginDocumentPip({
      width: 480,
      height: 270,
      fallbackToVideoPiP: true,
      placeholder: 'Playing in Picture-in-Picture'
    })
  ]
})

fire.on('document-pip', active => console.log(active))
Instance API: exposes isSupported, isActive, open(), close() and toggle(). Browser support for Document PiP is limited, so the fallback is useful.
13.12 / Plugin

fireplayer-plugin-ambilight

Creates a dynamic ambient-light effect around the player using sampled video frames.

v1.1.0
Installnpm i fireplayer-plugin-ambilight

Key API: blur · opacity · frequency · zIndex · duration · start · stop

fireplayerPluginAmbilight
import fireplayerPluginAmbilight from 'fireplayer-plugin-ambilight'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginAmbilight({
      blur: '50px',
      opacity: 1,
      frequency: 10,
      duration: 0.3
    })
  ]
})
Performance: frequency controls how often the effect updates. Lower update frequency reduces rendering work on constrained devices.
13.13 / Plugin

fireplayer-plugin-asr

Captures PCM/WAV audio chunks from playback for speech-to-text workflows and displays returned subtitles.

v2.1.0
Installnpm i fireplayer-plugin-asr

Key API: length · interval · sampleRate · autoHideTimeout · onAudioChunk · append · hide · stop

fireplayerPluginAsr
import fireplayerPluginAsr from 'fireplayer-plugin-asr'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/speech.mp4',
  plugins: [
    fireplayerPluginAsr({
      sampleRate: 16000,
      interval: 250,
      async onAudioChunk({ wav }) {
        const response = await fetch('/api/asr', { method: 'POST', body: wav })
        const data = await response.json()
        return data.text
      }
    })
  ]
})
Backend responsibility: Fire Player only captures audio chunks. Speech recognition is supplied by your own endpoint or ASR provider. The instance also exposes append(), hide() and stop().
13.14 / Plugin

fireplayer-plugin-danmuku

Danmuku/bullet-comment rendering with scrolling, top and bottom modes, filtering, emitter controls and heatmap support.

v5.3.0
Installnpm i fireplayer-plugin-danmuku

Key API: danmuku · speed · margin · opacity · color · mode · modes · fontSize · antiOverlap · heatmap · filter · beforeEmit · beforeVisible · emit · load · config

fireplayerPluginDanmuku
import fireplayerPluginDanmuku from 'fireplayer-plugin-danmuku'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginDanmuku({
      danmuku: '/comments/danmuku.xml',
      speed: 5,
      opacity: 1,
      mode: 0,
      modes: [0, 1, 2],
      antiOverlap: true,
      heatmap: true,
      filter: item => item.text.length <= 200,
      beforeEmit: async item => saveDanmuku(item)
    })
  ]
})

fire.plugins.fireplayerPluginDanmuku.emit({ text: 'Fire Player', time: fire.currentTime })
Modes: 0 scrolls, 1 pins at the top and 2 pins at the bottom. The plugin accepts an array, URL, Promise or async loader as its danmuku source.
13.15 / Plugin

fireplayer-plugin-danmuku-mask

Uses MediaPipe selfie segmentation to mask danmuku around foreground people.

v1.1.0
Installnpm i fireplayer-plugin-danmuku-mask

Key API: solutionPath · modelSelection · smoothSegmentation · minDetectionConfidence · minTrackingConfidence · foregroundThreshold · opacity · maskBlurAmount · start · stop

fireplayerPluginDanmukuMask
import fireplayerPluginDanmuku from 'fireplayer-plugin-danmuku'
import fireplayerPluginDanmukuMask from 'fireplayer-plugin-danmuku-mask'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginDanmuku({ danmuku: '/comments/danmuku.xml' }),
    fireplayerPluginDanmukuMask({
      solutionPath: '/vendor/mediapipe/selfie_segmentation',
      smoothSegmentation: true,
      foregroundThreshold: 0.5
    })
  ]
})
Dependency: deploy @mediapipe/selfie_segmentation assets and point solutionPath to that directory. Use this plugin together with the Danmuku plugin.
13.16 / Plugin

fireplayer-plugin-jassub

Renders ASS/SSA subtitles through JASSUB/libass with WebAssembly workers and custom fonts.

v1.1.0
Installnpm i fireplayer-plugin-jassub

Key API: workerUrl · wasmUrl · modernWasmUrl · subUrl · subContent · timeOffset · fonts · availableFonts · fallbackFont · useLocalFonts

fireplayerPluginJassub
import fireplayerPluginJassub from 'fireplayer-plugin-jassub'

const fire = new FirePlayer({
  container: '#player',
  url: '/media/movie.mp4',
  plugins: [
    fireplayerPluginJassub({
      subUrl: '/subtitles/movie.ass',
      workerUrl: '/vendor/jassub/jassub-worker.js',
      wasmUrl: '/vendor/jassub/jassub-worker.wasm',
      modernWasmUrl: '/vendor/jassub/jassub-worker-modern.wasm',
      fallbackFont: 'Arial'
    })
  ]
})
Deployment: the worker and both WASM files must be publicly reachable. Custom fonts can be supplied through fonts and availableFonts.
14 / Extend

Custom media types

A custom type handler receives the player video element, URL and Fire Player instance. Use it to attach any compatible playback engine.

JavaScript
customType: {
  custom(video, url, fire) {
    attachYourEngine(video, url)
    fire.once('destroy', () => disposeYourEngine())
  }
}
15 / Extend

Theme and CSS variables

Set the primary theme with the theme option. For granular runtime customization, pass cssVar or use fire.cssVar(key, value).

JavaScript
fire.theme = '#ff1708'
fire.cssVar('--fire-theme', '#ff1708')
16 / Extend

Internationalization

Set lang for the active language and provide i18n to extend or override translation dictionaries. The runtime also exposes fire.i18n.update().

17 / Ship

CORS and remote media

Player code cannot bypass browser origin policy. Remote manifests, segments, subtitle files, encryption keys and media assets must return headers appropriate to the origin serving Fire Player.

Screenshots: cross-origin video frames can taint the canvas. If you use screenshot APIs with remote media, configure the media server and video element attributes accordingly.
18 / Ship

Deployment

This website is directory-based static HTML. Public routes are clean: /docs/, /download/ and /playground/. No public navigation uses file extensions.

Nginx

Nginx
server {
  server_name fireplayer.net www.fireplayer.net;
  root /www/wwwroot/fireplayer.net;
  location / {
    try_files $uri $uri/ =404;
  }
}
19 / Ship

License

Fire Player is distributed under the MIT license. Keep the license and copyright notices included with the source and release packages when redistributing derivative builds.

Open downloads

No documentation sections match that search.