@tavora/sdk / MediaSession
Interface: MediaSession
Defined in: packages/sdk/src/protocol.ts:417
One app that plays something, as Windows' media controls (the volume flyout) show it: Spotify, a browser tab, a video player. Texts are as the app gives them and may be empty.
Properties
album
album:
string
Defined in: packages/sdk/src/protocol.ts:426
app
app:
object
Defined in: packages/sdk/src/protocol.ts:421
The app: id as Windows names it (such as "Spotify.exe"), name a readable name (such as "Spotify").
id
id:
string
name
name:
string
artist
artist:
string
Defined in: packages/sdk/src/protocol.ts:425
can
can:
Record<MediaAction,boolean>
Defined in: packages/sdk/src/protocol.ts:439
Which actions the app takes now.
cover
cover:
string|null
Defined in: packages/sdk/src/protocol.ts:437
The cover as a JPEG data URL, at most 300 px on each side, or null when there is none.
current
current:
boolean
Defined in: packages/sdk/src/protocol.ts:423
The session Windows' media keys work on now. At most one is.
durationMs
durationMs:
number|null
Defined in: packages/sdk/src/protocol.ts:435
The song's length in milliseconds, or null when the app doesn't say.
id
id:
string
Defined in: packages/sdk/src/protocol.ts:419
Stays the same while the session lasts; pass it to media.control.
positionAt
positionAt:
number|null
Defined in: packages/sdk/src/protocol.ts:433
positionMs
positionMs:
number|null
Defined in: packages/sdk/src/protocol.ts:432
Where the song was at positionAt (milliseconds since 1970), in milliseconds. While playing it runs on from there, so count forward yourself; a new media.changed comes when it jumps. Null when the app doesn't say.
status
status:
MediaStatus
Defined in: packages/sdk/src/protocol.ts:427
title
title:
string
Defined in: packages/sdk/src/protocol.ts:424