NowPlaying Addon
Read active media session metadata and control playback — play, pause, skip, seek, shuffle, and repeat.
import { addon } from "novadesk";
const nowPlaying = addon.load("path/to/NowPlaying.dll");Table of Contents
Returns current media session metadata. Call on a short interval (500–1000ms) to keep the UI updated.
| Property | Type | Description |
|---|---|---|
available | boolean | true when a media session is active. |
player | string | Player/app name. |
artist | string | Track artist. |
album | string | Track album. |
title | string | Track title. |
thumbnail | string | Cached thumbnail path, or empty string. |
duration | number | Track duration in seconds. |
position | number | Current playback position in seconds. |
progress | number | Playback progress 0–100. |
state | number | 0 = stopped/unknown, 1 = playing, 2 = paused. |
status | number | 0 = closed, 1 = opened. |
shuffle | boolean | Shuffle state. |
repeat | boolean | Repeat state. |
object An object with media session details. Always returns an object — check available before using other fields.const s = nowPlaying.stats();
if (s.available) {
console.log(s.artist, "-", s.title);
console.log("Progress:", s.progress + "%");
} else {
console.log("Nothing playing");
}Returns the active backend name.
string "winrt" when the backend is active, "disabled" otherwise.console.log("Backend:", nowPlaying.backend());Playback Controls
All playback control functions return true if the action was queued (backend is enabled), false otherwise.
Sends a play command to the active media session.
boolean true if the command was sent to the active session.nowPlaying.play();Sends a pause command to the active media session.
boolean true if the command was sent to the active session.nowPlaying.pause();Toggles play/pause on the active media session.
boolean true if the command was sent to the active session.nowPlaying.playPause();Stops the active media session.
boolean true if the command was sent to the active session.nowPlaying.stop();Skips to the next track.
boolean true if the command was sent to the active session.nowPlaying.next();Goes to the previous track.
boolean true if the command was sent to the active session.nowPlaying.previous();Seeks to a position in the current track.
PARAMETERS
boolean true if the seek command was sent, false otherwise.// Seek to 30 seconds
nowPlaying.setPosition(30);
// Seek to 50% of the track
nowPlaying.setPosition(50, true);Sets the shuffle state of the active media session.
PARAMETERS
boolean true if the command was sent.nowPlaying.setShuffle(true);Toggles shuffle on the active media session.
boolean true if the command was sent.nowPlaying.toggleShuffle();Sets the repeat mode of the active media session.
PARAMETERS
boolean true if the command was sent.nowPlaying.setRepeat(2); // repeat all
nowPlaying.setRepeat(0); // no repeat