Plugin: Message
MessagePlugin (id 'message') is a toast/overlay message surface mounted on the player container, for feedback like “quality switched to 1080p” or “reconnecting…”. Not re-exported from the main entry, import it from the plugins/message subpath.
Options
| Option | Type | Default | Purpose |
|---|---|---|---|
durationMs | number | 3000 | Default auto-hide delay for transient messages. |
mountSelector | string | player container | Where the toast surface mounts. |
Rules & restrictions
- Accessibility is built in, not optional: the toast surface carries
role="status"andaria-live="polite", and persistent messages carry the same attributes. Nothing to wire up separately. - Persistent messages (
displayPersistent(text, id)) are time-independent: they stay untilremovePersistent(id)is called explicitly with the sameid, there’s no timeout fallback.
How to extend it
TypeScript
import nmplayer from '@nomercy-entertainment/nomercy-video-player'; // nomercy-music-player's factory works identically
import { MessagePlugin } from '@nomercy-entertainment/nomercy-player-core/plugins/message';
const player = nmplayer('player');
player.addPlugin(MessagePlugin, { durationMs: 4000 });
await player.ready();
const toast = player.getPlugin(MessagePlugin);
toast!.show('Quality switched to 1080p');
toast!.displayPersistent('Reconnecting…', 'reconnect-banner');
// later:
toast!.removePersistent('reconnect-banner');
// A sequence of transient toasts, each shown for its own durationMs, one after another:
toast!.queue(['Buffering…', { text: 'Reconnected', durationMs: 2000 }]);
show(input) and queue(messages) both accept a plain string (uses the plugin’s default durationMs) or { text, durationMs? } (overrides the default for that one message). Calling queue() again, or clear(), cancels an in-flight sequence immediately.
Next steps
- Plugin: Tab Leader: single-tab playback enforcement across multiple open tabs.