Skip to content

Commit

Permalink
feat: add react sample for audio
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-berger committed Nov 30, 2024
1 parent 001951b commit 6d377c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion examples/boilerplate-react-buildless/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
memory: { type: 'memory' },
weather: { type: 'weather' },
media: { type: 'media' },
audio: { type: 'audio' },
});

createRoot(document.getElementById('root')).render(<App />);
Expand All @@ -50,8 +51,24 @@

return (
<div className="app">
{output.audio?.defaultPlaybackDevice && (
<div class="chip">
{output.audio.defaultPlaybackDevice.name}-
{output.audio.defaultPlaybackDevice.volume}
<input
type="range"
min="0"
max="100"
step="2"
value={output.audio.defaultPlaybackDevice.volume}
onChange={e =>
output.audio.setVolume(e.target.valueAsNumber)
}
/>
</div>
)}
<div class="chip">
Media: {output.media?.currentSession?.title} -
Media: {output.media?.currentSession?.title}-
{output.media?.currentSession?.artist}
<button onClick={() => output.media?.togglePlayPause()}>
Expand Down
2 changes: 1 addition & 1 deletion examples/boilerplate-solid-ts/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function App() {
</div>
)}
<div class="chip">
Media: {output.media?.currentSession?.title} -
Media: {output.media?.currentSession?.title}-
{output.media?.currentSession?.artist}
<button onClick={() => output.media?.togglePlayPause()}></button>
</div>
Expand Down

0 comments on commit 6d377c7

Please sign in to comment.