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.
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.
<div id="player"></div>
<script src="/vendor/fireplayer.js"></script>
<script>
const fire = new FirePlayer({
container: '#player',
url: '/media/video.mp4'
})
</script>Getting started
Browser build
Download the browser release and serve fireplayer.js from your own origin.
<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
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.
HLS and DASH
Adaptive streaming engines are intentionally attached through customType. This keeps the core independent of a specific HLS or DASH runtime.
HLS
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
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.
TypeScript
The release includes types/fireplayer.d.ts plus typed option, event, component, setting, subtitle, quality and utility definitions.
import FirePlayer, { type Option } from 'fireplayer'
const option: Option = {
container: '#player',
url: '/video.mp4',
fullscreen: true
}
const fire = new FirePlayer(option)Constructor options
container and url are the only required options. The remaining features are opt-in or resolved by the core.
| Option | Type | Default | Purpose |
|---|---|---|---|
| id | string | — | Logical player id. |
| container | string | HTMLDivElement | required | Mount target. |
| url | string | required | Video or stream URL. |
| poster | string | — | Poster image URL. |
| type | CustomType | auto | Media type: flv, m3u8, hls, ts, mpd, torrent or custom. |
| theme | string | — | Primary player theme color. |
| lang | I18n key | — | Player interface language. |
| volume | number | — | Initial volume. |
| isLive | boolean | false | Live broadcast mode. |
| muted | boolean | false | Start muted. |
| autoplay | boolean | false | Request autoplay. |
| autoSize | boolean | false | Resize player to video. |
| autoMini | boolean | false | Automatically enter mini mode. |
| loop | boolean | false | Loop playback. |
| flip | boolean | false | Expose flip controls. |
| playbackRate | boolean | false | Expose playback-rate controls. |
| aspectRatio | boolean | false | Expose aspect-ratio controls. |
| screenshot | boolean | false | Expose screenshot control. |
| setting | boolean | false | Expose settings panel. |
| hotkey | boolean | false | Enable keyboard controls. |
| pip | boolean | false | Expose picture-in-picture. |
| mutex | boolean | false | Allow one active player at a time. |
| backdrop | boolean | false | Enable UI backdrop. |
| fullscreen | boolean | false | Expose native fullscreen. |
| fullscreenWeb | boolean | false | Expose web fullscreen. |
| subtitleOffset | boolean | false | Enable subtitle timing offset. |
| miniProgressBar | boolean | false | Show compact progress while controls are hidden. |
| useSSR | boolean | false | Enable SSR-oriented behavior. |
| playsInline | boolean | false | Use inline playback on mobile. |
| lock | boolean | false | Enable mobile lock mode. |
| gesture | boolean | false | Enable mobile gestures. |
| fastForward | boolean | false | Enable mobile fast-forward behavior. |
| autoPlayback | boolean | false | Enable automatic playback continuation behavior. |
| autoOrientation | boolean | false | Enable mobile orientation handling. |
| airplay | boolean | false | Expose AirPlay. |
| proxy | function | — | Provide a custom video/canvas proxy. |
| plugins | function[] | [] | Plugin factories. |
| layers | ComponentOption[] | [] | Custom overlay layers. |
| contextmenu | ComponentOption[] | [] | Custom context-menu entries. |
| controls | ComponentOption[] | [] | Custom control entries. |
| settings | Setting[] | [] | Custom settings. |
| quality | Quality[] | [] | Manual quality variants. |
| highlight | {{time,text}}[] | [] | Timeline highlights. |
| thumbnails | Thumbnails | — | Timeline thumbnail sprite configuration. |
| subtitle | Subtitle | — | Subtitle source and styling. |
| moreVideoAttr | object | — | Additional HTMLVideoElement properties. |
| i18n | I18n | — | Custom translations. |
| icons | object | — | Custom icon markup. |
| cssVar | object | — | Player CSS variable overrides. |
| customType | Record | — | Custom media type handlers. |
Player properties
Most playback state is exposed as direct JavaScript properties. Setters update the underlying player immediately.
| Property | Access | Purpose |
|---|---|---|
| url | get / set | Current media URL. |
| currentTime | get / set | Playback position in seconds. |
| duration | get | Media duration. |
| played | get | Played progress. |
| playing | get | Whether playback is active. |
| volume | get / set | Volume level. |
| muted | get / set | Mute state. |
| playbackRate | get / set | Playback speed. |
| aspectRatio | get / set | Current aspect ratio. |
| flip | get / set | Video flip mode. |
| fullscreen | get / set | Native fullscreen state. |
| fullscreenWeb | get / set | Web fullscreen state. |
| pip | get / set | Picture-in-picture state. |
| mini | get / set | Mini-player state. |
| poster | get / set | Poster URL. |
| theme | get / set | Theme color. |
| state | get / set | standard, mini, pip, fullscreen or fullscreenWeb. |
| quality | get / set | Quality source list. |
| subtitleOffset | get / set | Subtitle time offset. |
| thumbnails | get / set | Timeline thumbnail configuration. |
| video | get | Underlying HTMLVideoElement. |
| option | get | Resolved player options. |
| plugins | get | Plugin registry and dynamic add API. |
| storage | get | Fire Player local settings storage interface. |
Methods
| Method | Return | Purpose |
|---|---|---|
| play() | Promise | Start playback. |
| pause() | void | Pause playback. |
| toggle() | void | Toggle play/pause. |
| switchUrl(url) | Promise | Switch media source. |
| switchQuality(url) | Promise | Switch quality source. |
| screenshot(name?) | Promise | Capture and optionally download a frame. |
| getDataURL() | Promise | Return the current frame as a data URL. |
| getBlobUrl() | Promise | Return the current frame as a blob URL. |
| airplay() | void | Open AirPlay when supported. |
| autoSize() | void | Resize to media dimensions. |
| autoHeight() | void | Recalculate height. |
| reset() | void | Reset player state. |
| destroy(removeHtml?) | void | Destroy the Fire Player instance. |
| on(name, fn) | this | Subscribe to an event. |
| once(name, fn) | this | Subscribe once. |
| off(name, fn?) | this | Remove event listeners. |
| emit(name, ...args) | this | Emit an event. |
| attr(key, value?) | unknown | Read or write a video attribute. |
| cssVar(key, value?) | CssVar value | Read or write a Fire Player CSS variable. |
fire.on('ready', () => fire.play())
fire.seek = 42
fire.volume = 0.6
await fire.switchUrl('/next-video.mp4')
fire.destroy()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:waitingfire.on('ready', () => {})
fire.on('video:timeupdate', event => {})
fire.on('fullscreen', state => {})
fire.on('error', (error, reconnectTime) => {})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.
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.25Manual quality lists
For direct-file variants, provide a quality array. Each item contains display HTML/text and a URL.
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.
Controls, layers and context menu
All three surfaces use component options with names, ordering, HTML, styles and lifecycle callbacks.
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.
Custom settings
Settings support selectors, switches and ranges. Use the callback this context to access the active Fire Player instance.
settings: [{
html: 'Low latency',
switch: true,
onSwitch(item) {
item.switch = !item.switch
return item.switch
}
}]Mobile behavior
Use playsInline, lock, gesture, fastForward and autoOrientation explicitly. Native autoplay and fullscreen restrictions still come from the browser and operating system.
{
playsInline: true,
lock: true,
gesture: true,
fastForward: true,
autoOrientation: true,
fullscreen: true
}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.
| Package | Version | Purpose |
|---|---|---|
fireplayer-plugin-ads | v2.1.0 | Pre-roll HTML or video advertising with skip timing, click-through, mute/fullscreen controls and ad lifecycle events. |
fireplayer-plugin-vast | v1.2.0 | VAST/IMA advertising through Google IMA and @glomex/vast-ima-player. Supports ad-tag URLs and raw VAST responses. |
fireplayer-plugin-hls-control | v1.1.0 | Adds HLS quality and audio selectors to controls and/or settings. Requires an HLS.js instance exposed as fire.hls. |
fireplayer-plugin-dash-control | v1.1.0 | Adds DASH quality and audio selectors. Requires a dash.js instance exposed as fire.dash. |
fireplayer-plugin-chromecast | v1.1.0 | Adds Google Cast support and a Chromecast control. |
fireplayer-plugin-multiple-subtitles | v1.2.0 | Loads multiple VTT, SRT or ASS subtitle sources and merges or switches tracks at runtime. |
fireplayer-plugin-audio-track | v1.1.0 | Synchronizes an external audio file with the video element, useful for alternate dubbing or replacement audio. |
fireplayer-plugin-chapter | v1.1.0 | Segments the progress bar into chapters and shows chapter titles while seeking. |
fireplayer-plugin-vtt-thumbnail | v1.1.0 | Reads WebVTT thumbnail cues and renders sprite thumbnails on progress hover or mobile seek. |
fireplayer-plugin-auto-thumbnail | v1.1.0 | Generates a thumbnail sprite in the browser by seeking through the media and drawing frames to canvas. |
fireplayer-plugin-document-pip | v1.1.0 | Moves the complete player UI into Document Picture-in-Picture when supported, with video PiP fallback. |
fireplayer-plugin-ambilight | v1.1.0 | Creates a dynamic ambient-light effect around the player using sampled video frames. |
fireplayer-plugin-asr | v2.1.0 | Captures PCM/WAV audio chunks from playback for speech-to-text workflows and displays returned subtitles. |
fireplayer-plugin-danmuku | v5.3.0 | Danmuku/bullet-comment rendering with scrolling, top and bottom modes, filtering, emitter controls and heatmap support. |
fireplayer-plugin-danmuku-mask | v1.1.0 | Uses MediaPipe selfie segmentation to mask danmuku around foreground people. |
fireplayer-plugin-jassub | v1.1.0 | Renders ASS/SSA subtitles through JASSUB/libass with WebAssembly workers and custom fonts. |
fire.hls or your dash.js instance to fire.dash.fireplayer-plugin-ads
Pre-roll HTML or video advertising with skip timing, click-through, mute/fullscreen controls and ad lifecycle events.
npm i fireplayer-plugin-adsKey API: html · video · url · playDuration · totalDuration · muted · i18n
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))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().fireplayer-plugin-vast
VAST/IMA advertising through Google IMA and @glomex/vast-ima-player. Supports ad-tag URLs and raw VAST responses.
npm i fireplayer-plugin-vastKey API: playUrl · playRes · init · ima · imaPlayer · adsRenderingSettings · playerOptions
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')
})
})
]
})@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.fireplayer-plugin-hls-control
Adds HLS quality and audio selectors to controls and/or settings. Requires an HLS.js instance exposed as fire.hls.
npm i fireplayer-plugin-hls-controlKey API: quality · audio · control · setting · title · auto · getName · update
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())
}
}
})fire.hls. The control plugin reads levels and audio tracks from that instance and exposes update().fireplayer-plugin-dash-control
Adds DASH quality and audio selectors. Requires a dash.js instance exposed as fire.dash.
npm i fireplayer-plugin-dash-controlKey API: quality · audio · control · setting · title · auto · getName · update
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())
}
}
})fire.dash. The plugin uses the DASH bitrate list, current quality and audio tracks to build selectors.fireplayer-plugin-chromecast
Adds Google Cast support and a Chromecast control.
npm i fireplayer-plugin-chromecastKey API: url · sdk · icon · mimeType
import fireplayerPluginChromecast from 'fireplayer-plugin-chromecast'
const fire = new FirePlayer({
container: '#player',
url: '/media/movie.mp4',
plugins: [
fireplayerPluginChromecast({
mimeType: 'video/mp4'
})
]
})url, Cast sdk, control icon or mimeType when automatic detection is not suitable.fireplayer-plugin-multiple-subtitles
Loads multiple VTT, SRT or ASS subtitle sources and merges or switches tracks at runtime.
npm i fireplayer-plugin-multiple-subtitlesKey API: subtitles · url · name · type · encoding · tracks · reset
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()tracks(names) activates selected named tracks; reset() restores all configured tracks.fireplayer-plugin-audio-track
Synchronizes an external audio file with the video element, useful for alternate dubbing or replacement audio.
npm i fireplayer-plugin-audio-trackKey API: url · offset · sync · audio · update
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 })offset is measured in seconds. Positive values make the external audio lead the video; negative values delay it. sync is the resynchronization threshold.fireplayer-plugin-chapter
Segments the progress bar into chapters and shows chapter titles while seeking.
npm i fireplayer-plugin-chapterKey API: chapters · start · end · title · update
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' }
]
})
]
})Infinity is accepted for the final chapter end and resolves to the video duration.fireplayer-plugin-vtt-thumbnail
Reads WebVTT thumbnail cues and renders sprite thumbnails on progress hover or mobile seek.
npm i fireplayer-plugin-vtt-thumbnailKey API: vtt · style
import fireplayerPluginVttThumbnail from 'fireplayer-plugin-vtt-thumbnail'
const fire = new FirePlayer({
container: '#player',
url: '/media/movie.mp4',
plugins: [
fireplayerPluginVttThumbnail({
vtt: '/thumbnails/movie.vtt'
})
]
})style accepts CSSStyleDeclaration-compatible overrides for the thumbnail control.fireplayer-plugin-auto-thumbnail
Generates a thumbnail sprite in the browser by seeking through the media and drawing frames to canvas.
npm i fireplayer-plugin-auto-thumbnailKey API: url · width · number · scale
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
})
]
})fireplayer-plugin-document-pip
Moves the complete player UI into Document Picture-in-Picture when supported, with video PiP fallback.
npm i fireplayer-plugin-document-pipKey API: width · height · placeholder · fallbackToVideoPiP · open · close · toggle · isSupported · isActive
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))isSupported, isActive, open(), close() and toggle(). Browser support for Document PiP is limited, so the fallback is useful.fireplayer-plugin-ambilight
Creates a dynamic ambient-light effect around the player using sampled video frames.
npm i fireplayer-plugin-ambilightKey API: blur · opacity · frequency · zIndex · duration · start · stop
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
})
]
})frequency controls how often the effect updates. Lower update frequency reduces rendering work on constrained devices.fireplayer-plugin-asr
Captures PCM/WAV audio chunks from playback for speech-to-text workflows and displays returned subtitles.
npm i fireplayer-plugin-asrKey API: length · interval · sampleRate · autoHideTimeout · onAudioChunk · append · hide · stop
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
}
})
]
})append(), hide() and stop().fireplayer-plugin-danmuku
Danmuku/bullet-comment rendering with scrolling, top and bottom modes, filtering, emitter controls and heatmap support.
npm i fireplayer-plugin-danmukuKey API: danmuku · speed · margin · opacity · color · mode · modes · fontSize · antiOverlap · heatmap · filter · beforeEmit · beforeVisible · emit · load · config
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 })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.fireplayer-plugin-danmuku-mask
Uses MediaPipe selfie segmentation to mask danmuku around foreground people.
npm i fireplayer-plugin-danmuku-maskKey API: solutionPath · modelSelection · smoothSegmentation · minDetectionConfidence · minTrackingConfidence · foregroundThreshold · opacity · maskBlurAmount · start · stop
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
})
]
})@mediapipe/selfie_segmentation assets and point solutionPath to that directory. Use this plugin together with the Danmuku plugin.fireplayer-plugin-jassub
Renders ASS/SSA subtitles through JASSUB/libass with WebAssembly workers and custom fonts.
npm i fireplayer-plugin-jassubKey API: workerUrl · wasmUrl · modernWasmUrl · subUrl · subContent · timeOffset · fonts · availableFonts · fallbackFont · useLocalFonts
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'
})
]
})fonts and availableFonts.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.
customType: {
custom(video, url, fire) {
attachYourEngine(video, url)
fire.once('destroy', () => disposeYourEngine())
}
}Theme and CSS variables
Set the primary theme with the theme option. For granular runtime customization, pass cssVar or use fire.cssVar(key, value).
fire.theme = '#ff1708'
fire.cssVar('--fire-theme', '#ff1708')Internationalization
Set lang for the active language and provide i18n to extend or override translation dictionaries. The runtime also exposes fire.i18n.update().
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.
Deployment
This website is directory-based static HTML. Public routes are clean: /docs/, /download/ and /playground/. No public navigation uses file extensions.
Nginx
server {
server_name fireplayer.net www.fireplayer.net;
root /www/wwwroot/fireplayer.net;
location / {
try_files $uri $uri/ =404;
}
}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.