Reference: BasePlayerConfig
The object passed to setup(config). nomercy-video-player and nomercy-music-player each extend this with their own domain fields (video adds muted, autoPlay, stretching, playbackRates, preload, disableMediaControls, disableControls, backendFactory, defaultSubtitleLanguage, defaultAudioLanguage, defaultQuality, theaterDefault, and autoAdvance; music adds backend, backendFactory, and crossfadeDefaults), everything below is shared by both.
| Field | Type | Default | Notes |
|---|
logLevel | LogLevel | — | Verbosity for the player and every registered plugin. |
logger | ILogger | kit Logger | Any ILogger implementation (Pino, Winston, custom). |
baseUrl | string | — | Prepended to relative playlist item URLs. Absolute URLs pass through unchanged. Mandatory for any playlist example, see Quickstart. |
baseImageUrl | string | — | Same idea, for relative image/poster/thumbnail/cover paths. |
defaultVolume | number | 100 | Initial volume, 0-100 scale. |
playlist | BasePlaylistItem[] | string | — | Initial items, or a URL the player fetches. |
transformPlaylistItem | (item) => item | — | Reshape every item as it enters the queue, after built-in normalization. Keep it synchronous. |
expose | boolean | false | Attach the instance to window.player (and the factory to window.nmplayer) for console debugging. |
clockSource | () => number | Date.now | Timestamp source for distributed-sync plugins. |
plugins | ReadonlyArray<PluginSpec> | — | Declarative plugin registration, drained before the setup pipeline’s pluginsRegistering stage. Sugar over addPlugin(), each entry a class ref or { plugin, opts }. |
| Field | Type | Default | Notes |
|---|
auth | AuthConfig | — | bearerToken, headers, credentials, transformUrl, signRequest, refreshOnUnauthenticated, retryAfterRefresh. See Recipe: Use authFetch. |
urlResolver | IUrlResolver | built-in auth.transformUrl + parse | See Adapter: URL Resolver. |
| Field | Type | Default | Notes |
|---|
language | string | navigator.language | BCP-47 tag. |
translations | Translations | — | Bundles by language tag. The kit’s English bundle always merges underneath. |
loadTranslations | TranslationLoader | — | Async loader invoked when a tag’s bundle isn’t loaded yet. |
onMissingTranslation | (key, lang) => string | returns key | Fallback for an unresolved key. |
translator | ITranslator | DefaultTranslator | See Adapter: Translator. |
| Field | Type | Default | Notes |
|---|
metricsIntervalMs | number | 10000 | playback:metrics emit interval. 0 disables. |
progressIntervalMs | number | 5000 | Throttled progress emit interval, prefer over time for watch-position saves. |
inactivityMs | number | 4000 | Idle time (no pointer, touch, or key on the container) before activity { active: false } fires while playing, swapping the container’s .active class for .inactive. Never fires while paused. 0 disables. |
itemEndingSoonThreshold | number | 10 | Seconds before natural end that itemEndingSoon fires. |
preloadLeadSeconds | number | 10 | Seconds before end that prefetch begins. 0 disables preloading. |
crossfadeLeadSeconds / crossfadeTailSeconds | number | 3 / 3 | Overlap window, only used when crossfadeEnabled: true. |
crossfadeEnabled | boolean | false video / true music | Overlap transition vs. hard-cut gapless. |
pluginInitTimeoutMs | number | 30000 | Cap on a plugin’s use() promise before it’s marked failed. |
beforeEventTimeoutMs | number | 10000 | Cap on BeforeEvent.delay(promise); timeout is treated as preventDefault. |
| Field | Type | Default | Notes |
|---|
pauseWhenHidden | boolean | false | Pause when the document goes hidden. |
controls | boolean | false | Render the browser’s native <audio controls> / <video controls> on the backing element. Doubles up if a UI plugin is also loaded, so use one or the other. |
onOffline | 'pause' | 'continue-buffered' | 'ignore' | 'continue-buffered' | Behavior on network:offline. |
wakeLock | 'auto' | 'always' | 'never' | 'auto' video / 'never' music | Wake-lock policy. |
cast | CastConfig | — | autoLoad, receiverApplicationId, autoJoinPolicy, resumeSavedSession, scriptUrl, loadTimeoutMs. |
mutationGuards | false | 'all' | ReadonlyArray<string> | guards normal mutations only | Controls which mutating methods fire beforeMutation + plugin advisories. |
- Reference: Events:
BaseEventMap, every event name and payload the fields above eventually produce.