Core Methods Reference
NMMusicPlayer<T> inherits the full kit method surface from playerCoreMethods.
These methods are identical in behavior to their equivalents on the video player.
Full documentation lives in the player core.
Transport
| Method | Signature | Core doc |
|---|---|---|
play | (opts?: ActionOptions) => Promise<void> | Transport |
pause | (opts?: ActionOptions) => Promise<void> | Transport |
stop | (opts?: ActionOptions) => Promise<void> | Transport |
togglePlayback | (opts?: ActionOptions) => Promise<void> | Transport |
restart | (opts?: ActionOptions) => Promise<void> | Transport |
next | (opts?: ActionOptions) => Promise<void> | Transport |
previous | (opts?: ActionOptions) => Promise<void> | Transport |
Time
| Method | Signature | Core doc |
|---|---|---|
time | () => number / (time, opts?) => Promise<void> | Time |
duration | () => number | Time |
buffered | () => number | Time |
bufferedRanges | () => TimeRanges | Time |
seekable | () => TimeRanges | Time |
timeData | () => TimeState | Time |
forward | (seconds?, opts?) => Promise<void> | Time |
rewind | (seconds?, opts?) => Promise<void> | Time |
seekByPercentage | (pct, opts?) => void | Time |
playbackRate | () => number / (rate) => void | Time |
playbackRates | () => number[] | Time |
Volume
| Method | Signature |
|---|---|
volume | () => number / (currentVolume) => void, 0–100 scale |
mute | () => void |
unmute | () => void |
toggleMute | () => void |
volumeUp | (step?: number) => void, default step: 5 |
volumeDown | (step?: number) => void, default step: 5 |
volumeState | () => VolumeState |
Queue
| Method | Signature |
|---|---|
queue | () => ReadonlyArray<T> / (items, opts?) => void |
queueAppend | (item or items, opts?) => void |
queuePrepend | (item or items, opts?) => void |
queueInsert | (item or items, index, opts?) => void |
queueRemove | (id, opts?) => void |
queueRemoveAt | (index, opts?) => void |
queueMove | (from, to, opts?) => void |
queueClear | (opts?) => void |
queueShuffle | (opts?) => void |
queueSort | (compareFn, opts?) => void |
queueLength | () => number |
queueIndexOf | (id) => number |
item | () => T | undefined / (target, opts?) => void |
index | () => number |
seekToIndex | (index, opts?) => void |
peekNext | () => T | undefined |
peekPrevious | () => T | undefined |
Shuffle and repeat
| Method | Signature |
|---|---|
shuffleState | () => ShuffleState / (state) => void |
repeatState | () => RepeatState / (state) => void |
playState | () => PlayState |
Backlog
| Method | Signature |
|---|---|
backlog | () => ReadonlyArray<T> / (items) => void |
backlogAppend | (item or items) => void |
backlogRemove | (id) => void |
backlogClear | () => void |
Plugins
| Method | Signature |
|---|---|
addPlugin | (PluginClass, opts?) => this |
getPlugin | <P>(PluginClass) => P | undefined |
getPluginById | (id) => Plugin | undefined |
removePlugin | (PluginClass) => void |
removePluginById | (id) => void |
plugins | () => ReadonlyArray<Plugin> |
enabledPlugins | () => ReadonlyArray<Plugin> |
Auth
| Method | Signature |
|---|---|
baseUrl | () => string | undefined / (url) => void |
State and diagnostics
| Method | Signature |
|---|---|
phase | () => PlayerPhase |
setupState | () => SetupState |
dispatching | () => ReadonlyArray<string> |
bufferState | () => BufferState |
networkState | () => NetworkState |
visibilityState | () => VisibilityState |
audioContext | () => AudioContext | undefined |
i18n
| Method | Signature |
|---|---|
t | (key, vars?) => string |
language | () => string / (lang) => Promise<void> |
addTranslations | (bundle) => void |
removeTranslations | (prefix, lang?) => void |
Cue parsers
| Method | Signature |
|---|---|
registerCueParser | (parser, prepend?) => void |
unregisterCueParser | (id) => void |
resolveCueParser | (url) => ICueParser | undefined |
Stream registration
| Method | Signature |
|---|---|
registerStream | (factory, prepend?) => this |
unregisterStream | (id) => this |
streams | () => ReadonlyArray<string> |
getStreamFactory | (id) => StreamFactory | undefined |
Events
| Method | Signature |
|---|---|
on | (event, handler) => void |
off | (event, handler) => void |
once | (event, handler) => void |
See also
- Player Core docs, authoritative documentation for all inherited methods
- API Methods (full), complete method listing with descriptions
- Events, full event reference