Skip to content

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.

Core

FieldTypeDefaultNotes
logLevelLogLevelVerbosity for the player and every registered plugin.
loggerILoggerkit LoggerAny ILogger implementation (Pino, Winston, custom).
baseUrlstringPrepended to relative playlist item URLs. Absolute URLs pass through unchanged. Mandatory for any playlist example, see Quickstart.
baseImageUrlstringSame idea, for relative image/poster/thumbnail/cover paths.
defaultVolumenumber100Initial volume, 0-100 scale.
playlistBasePlaylistItem[] | stringInitial items, or a URL the player fetches.
transformPlaylistItem(item) => itemReshape every item as it enters the queue, after built-in normalization. Keep it synchronous.
exposebooleanfalseAttach the instance to window.player (and the factory to window.nmplayer) for console debugging.
clockSource() => numberDate.nowTimestamp source for distributed-sync plugins.
pluginsReadonlyArray<PluginSpec>Declarative plugin registration, drained before the setup pipeline’s pluginsRegistering stage. Sugar over addPlugin(), each entry a class ref or { plugin, opts }.

Auth

FieldTypeDefaultNotes
authAuthConfigbearerToken, headers, credentials, transformUrl, signRequest, refreshOnUnauthenticated, retryAfterRefresh. See Recipe: Use authFetch.
urlResolverIUrlResolverbuilt-in auth.transformUrl + parseSee Adapter: URL Resolver.

i18n

FieldTypeDefaultNotes
languagestringnavigator.languageBCP-47 tag.
translationsTranslationsBundles by language tag. The kit’s English bundle always merges underneath.
loadTranslationsTranslationLoaderAsync loader invoked when a tag’s bundle isn’t loaded yet.
onMissingTranslation(key, lang) => stringreturns keyFallback for an unresolved key.
translatorITranslatorDefaultTranslatorSee Adapter: Translator.

Adapters

FieldTypeDefaultNotes
storageIStorageLocalStorageBackendSee Adapter: Storage.
platformIPlatformbrowserPlatformSee Adapter: Platform.
websocketFactoryRealtimeFactorynativeWebSocketAdapterSee Adapter: Realtime Channel.
cueParsersReadonlyArray<ICueParser>[]Registered alongside VTT/LRC/sprite-VTT, not instead of them.
shuffleStrategyIShuffleStrategyFisherYatesShuffleSee Adapter: Shuffle Strategy.
preloadStrategyIPreloadStrategyDefaultPreloadStrategySee Adapter: Preload Strategy.
transitionStrategyITransitionStrategyper-library (CrossfadeTransitionStrategy music / GaplessTransitionStrategy video)See Adapter: Transition Strategy.

Timing & thresholds

FieldTypeDefaultNotes
metricsIntervalMsnumber10000playback:metrics emit interval. 0 disables.
progressIntervalMsnumber5000Throttled progress emit interval, prefer over time for watch-position saves.
inactivityMsnumber4000Idle 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.
itemEndingSoonThresholdnumber10Seconds before natural end that itemEndingSoon fires.
preloadLeadSecondsnumber10Seconds before end that prefetch begins. 0 disables preloading.
crossfadeLeadSeconds / crossfadeTailSecondsnumber3 / 3Overlap window, only used when crossfadeEnabled: true.
crossfadeEnabledbooleanfalse video / true musicOverlap transition vs. hard-cut gapless.
pluginInitTimeoutMsnumber30000Cap on a plugin’s use() promise before it’s marked failed.
beforeEventTimeoutMsnumber10000Cap on BeforeEvent.delay(promise); timeout is treated as preventDefault.

Runtime behavior

FieldTypeDefaultNotes
pauseWhenHiddenbooleanfalsePause when the document goes hidden.
controlsbooleanfalseRender 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' musicWake-lock policy.
castCastConfigautoLoad, receiverApplicationId, autoJoinPolicy, resumeSavedSession, scriptUrl, loadTimeoutMs.
mutationGuardsfalse | 'all' | ReadonlyArray<string>guards normal mutations onlyControls which mutating methods fire beforeMutation + plugin advisories.

Next steps

  • Reference: Events: BaseEventMap, every event name and payload the fields above eventually produce.