Adapter: Platform
IPlatform bundles every primitive the kit would otherwise hardcode against a browser API, so a native-shell consumer (Capacitor, Tauri, Electron) injects native equivalents in one swap instead of patching five call sites.
The interface
| Field | Interface | Purpose |
|---|---|---|
wakeLock | IWakeLock | Keep the display awake during playback. acquire() / release() / isHeld(). |
network | INetworkMonitor | Online/offline + connection type. isOnline() / type() / downlinkMbps() / subscribe(). |
visibility | IVisibilityMonitor | Tab visibility. isVisible() / subscribe(). |
capabilities | ICapabilitiesProbe | Hardware decode capability, feeds ABR. canDecode(profile). |
fullscreen | IFullscreenController (optional) | Video only. |
pip | IPipController (optional) | Video only. |
Rules & restrictions
fullscreenandpipare video-only fields. The audio player never touches them; the video player throws a descriptiveBrowserPolicyErrorif either is invoked when the field wasn’t supplied.IWakeLock.acquire()throwsBrowserPolicyError('core:policy/wakeLockUnsupported')when the Screen Wake Lock API is unavailable, checkisSupported()first if you need to gate the feature instead of catching.downlinkMbps()andrttMs()returnundefinedon browsers without the Network Information API (Firefox, Safari as of this writing), not a fabricated number.
How to extend it
Partial overrides compose cleanly, spread the default and replace only the controller you need:
TypeScript
import nmplayer from '@nomercy-entertainment/nomercy-video-player'; // nomercy-music-player's factory works identically
import { browserPlatform } from '@nomercy-entertainment/nomercy-player-core';
const player = nmplayer('player');
player.setup({
platform: { ...browserPlatform, wakeLock: myCapacitorWakeLock },
});
Full native-shell adapters (@nomercy/platform-capacitor, @nomercy/platform-tauri, @nomercy/platform-electron) live outside the kit and replace the whole IPlatform object.
Next steps
- Adapter: Stream Source: the protocol-agnostic handle for a playing or pending media source.