Skip to content

Commit

Permalink
final changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-berger committed Nov 22, 2024
1 parent f6d1b04 commit 6a683b6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
7 changes: 5 additions & 2 deletions examples/boilerplate-react-buildless/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@
return (
<div className="app">
<div class="chip">
Media: {output.media?.session?.title} -
{output.media?.session?.artist}
Media: {output.media?.currentSession?.title} -
{output.media?.currentSession?.artist}
<button onClick={() => output.media?.togglePlayPause()}>
</button>
</div>
<div className="chip">CPU usage: {output.cpu?.usage}</div>
<div className="chip">
Expand Down
10 changes: 3 additions & 7 deletions examples/boilerplate-solid-ts/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@ function App() {
{output.audio?.defaultPlaybackDevice?.volume}
</div>
<div class="chip">
Media: {output.media?.session?.title} -
{output.media?.session?.artist}
<button onClick={() => output.media?.play()}>Play</button>
<button onClick={() => output.media?.pause()}>Pause</button>
Media: {output.media?.currentSession?.title} -
{output.media?.currentSession?.artist}
<button onClick={() => output.media?.togglePlayPause()}>
Toggle Play Pause
</button>
<button onClick={() => output.media?.next()}>Next</button>
<button onClick={() => output.media?.previous()}>Previous</button>
</div>
<div class="chip">CPU usage: {output.cpu?.usage}</div>
<div class="chip">
Expand Down
2 changes: 1 addition & 1 deletion packages/client-api/src/desktop/desktop-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface MediaFunction {
}

export interface MediaControlArgs {
sessionId: string | null;
sessionId?: string;
}

function startWidget(
Expand Down
10 changes: 5 additions & 5 deletions packages/client-api/src/providers/media/create-media-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function createMediaProvider(
type: 'media',
function: {
name: 'play',
args: args ?? { sessionId: null },
args: args ?? {},
},
});
},
Expand All @@ -41,7 +41,7 @@ export function createMediaProvider(
type: 'media',
function: {
name: 'pause',
args: args ?? { sessionId: null },
args: args ?? {},
},
});
},
Expand All @@ -50,7 +50,7 @@ export function createMediaProvider(
type: 'media',
function: {
name: 'toggle_play_pause',
args: args ?? { sessionId: null },
args: args ?? {},
},
});
},
Expand All @@ -59,7 +59,7 @@ export function createMediaProvider(
type: 'media',
function: {
name: 'next',
args: args ?? { sessionId: null },
args: args ?? {},
},
});
},
Expand All @@ -68,7 +68,7 @@ export function createMediaProvider(
type: 'media',
function: {
name: 'previous',
args: args ?? { sessionId: null },
args: args ?? {},
},
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface MediaOutput {
}

export interface MediaControlArgs {
sessionId: string;
sessionId?: string;
}

export interface MediaSession {
Expand Down

0 comments on commit 6a683b6

Please sign in to comment.