diff --git a/packages/client-api/src/desktop/desktop-commands.ts b/packages/client-api/src/desktop/desktop-commands.ts index e31bdf55..c0bd3721 100644 --- a/packages/client-api/src/desktop/desktop-commands.ts +++ b/packages/client-api/src/desktop/desktop-commands.ts @@ -25,35 +25,23 @@ export interface AudioFunction { type: 'audio'; function: { name: 'set_volume'; - args: SetVolumeArgs; + args: { + volume: number; + deviceId?: string; + }; }; } -export interface SetVolumeArgs { - volume: number; - deviceId?: string; -} - export interface MediaFunction { type: 'media'; function: { name: 'play' | 'pause' | 'toggle_play_pause' | 'next' | 'previous'; - args: MediaControlArgs; + args: { + sessionId?: string; + }; }; } -export interface MediaFunction { - type: 'media'; - function: { - name: 'play' | 'pause' | 'toggle_play_pause' | 'next' | 'previous'; - args: MediaControlArgs; - }; -} - -export interface MediaControlArgs { - sessionId?: string; -} - function startWidget( configPath: string, placement: WidgetPlacement, diff --git a/packages/client-api/src/providers/media/create-media-provider.ts b/packages/client-api/src/providers/media/create-media-provider.ts index 1d1a899e..c86bf5f5 100644 --- a/packages/client-api/src/providers/media/create-media-provider.ts +++ b/packages/client-api/src/providers/media/create-media-provider.ts @@ -2,7 +2,7 @@ import { z } from 'zod'; import { createBaseProvider } from '../create-base-provider'; import { desktopCommands, onProviderEmit } from '~/desktop'; import type { - MediaControlArgs, + MediaControlOptions, MediaOutput, MediaProvider, MediaProviderConfig, @@ -27,48 +27,48 @@ export function createMediaProvider( queue.output({ ...result.output, session: result.output.currentSession, - play: (args?: MediaControlArgs) => { + play: (options?: MediaControlOptions) => { return desktopCommands.callProviderFunction(configHash, { type: 'media', function: { name: 'play', - args: args ?? {}, + args: options ?? {}, }, }); }, - pause: (args?: MediaControlArgs) => { + pause: (options?: MediaControlOptions) => { return desktopCommands.callProviderFunction(configHash, { type: 'media', function: { name: 'pause', - args: args ?? {}, + args: options ?? {}, }, }); }, - togglePlayPause: (args?: MediaControlArgs) => { + togglePlayPause: (options?: MediaControlOptions) => { return desktopCommands.callProviderFunction(configHash, { type: 'media', function: { name: 'toggle_play_pause', - args: args ?? {}, + args: options ?? {}, }, }); }, - next: (args?: MediaControlArgs) => { + next: (options?: MediaControlOptions) => { return desktopCommands.callProviderFunction(configHash, { type: 'media', function: { name: 'next', - args: args ?? {}, + args: options ?? {}, }, }); }, - previous: (args?: MediaControlArgs) => { + previous: (options?: MediaControlOptions) => { return desktopCommands.callProviderFunction(configHash, { type: 'media', function: { name: 'previous', - args: args ?? {}, + args: options ?? {}, }, }); }, diff --git a/packages/client-api/src/providers/media/media-provider-types.ts b/packages/client-api/src/providers/media/media-provider-types.ts index b1973cfd..150f35bc 100644 --- a/packages/client-api/src/providers/media/media-provider-types.ts +++ b/packages/client-api/src/providers/media/media-provider-types.ts @@ -9,14 +9,14 @@ export interface MediaOutput { session: MediaSession | null; currentSession: MediaSession | null; allSessions: MediaSession[]; - play(args?: MediaControlArgs): void; - pause(args?: MediaControlArgs): void; - togglePlayPause(args?: MediaControlArgs): void; - next(args?: MediaControlArgs): void; - previous(args?: MediaControlArgs): void; + play(options?: MediaControlOptions): void; + pause(options?: MediaControlOptions): void; + togglePlayPause(options?: MediaControlOptions): void; + next(options?: MediaControlOptions): void; + previous(options?: MediaControlOptions): void; } -export interface MediaControlArgs { +export interface MediaControlOptions { sessionId?: string; }