feat(volume): Live-Volume-API + UI-Range setzt Lautstärke während Wiedergabe
This commit is contained in:
parent
8b0b7c75cd
commit
24de686a54
3 changed files with 45 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { fetchChannels, fetchSounds, playSound } from './api';
|
||||
import { fetchChannels, fetchSounds, playSound, setVolumeLive } from './api';
|
||||
import type { VoiceChannelInfo, Sound } from './types';
|
||||
|
||||
export default function App() {
|
||||
|
|
@ -88,7 +88,14 @@ export default function App() {
|
|||
max={1}
|
||||
step={0.01}
|
||||
value={volume}
|
||||
onChange={(e) => setVolume(parseFloat(e.target.value))}
|
||||
onChange={async (e) => {
|
||||
const v = parseFloat(e.target.value);
|
||||
setVolume(v);
|
||||
if (selected) {
|
||||
const [guildId] = selected.split(':');
|
||||
try { await setVolumeLive(guildId, v); } catch {}
|
||||
}
|
||||
}}
|
||||
aria-label="Lautstärke"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue