Skip to main content

Function: withQueueHandling()

function withQueueHandling<TBase extends MediaHandlerConstructor>(Base: TBase, options?: QueueHandlerOptions): TBase & (...args: any[]) => MediaHandler & QueueHandlerMethods;

Defined in: packages/media-session/src/queue-handler.ts:84

Give a handler default queue navigation over the data it broadcasts on channel 3.

The queue lives here, not in the session: resolving a skip may need to fetch a URL, shuffle, or consult a recommender, all of which are app concerns. What the mixin provides is the boring part — index arithmetic that is identical in every media app and wrong in half of them.

class MyHandler extends QueueHandler {
async playQueueItem(item: MediaItem) { await this.player.load(item.id) }
}

Type Parameters

Type Parameter
TBase extends MediaHandlerConstructor

Parameters

ParameterType
BaseTBase
optionsQueueHandlerOptions

Returns

TBase & (...args: any[]) => MediaHandler & QueueHandlerMethods