mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
Update volume slider description.
This commit is contained in:
@@ -146,7 +146,6 @@
|
|||||||
"screenshare_button_label": "Bildschirm teilen",
|
"screenshare_button_label": "Bildschirm teilen",
|
||||||
"settings": {
|
"settings": {
|
||||||
"audio_tab": {
|
"audio_tab": {
|
||||||
"effect_volume_description": "Lautstärke anpassen, mit der Reaktionen und Handmeldungen abgespielt werden",
|
|
||||||
"effect_volume_label": "Lautstärke der Soundeffekte"
|
"effect_volume_label": "Lautstärke der Soundeffekte"
|
||||||
},
|
},
|
||||||
"developer_settings_label": "Entwicklereinstellungen",
|
"developer_settings_label": "Entwicklereinstellungen",
|
||||||
|
|||||||
@@ -147,7 +147,7 @@
|
|||||||
"screenshare_button_label": "Share screen",
|
"screenshare_button_label": "Share screen",
|
||||||
"settings": {
|
"settings": {
|
||||||
"audio_tab": {
|
"audio_tab": {
|
||||||
"effect_volume_description": "Adjust the volume at which reactions and hand raised effects play",
|
"effect_volume_description": "Volume at which sound effects (such as reactions and call membership sounds) play",
|
||||||
"effect_volume_label": "Sound effect volume"
|
"effect_volume_label": "Sound effect volume"
|
||||||
},
|
},
|
||||||
"developer_settings_label": "Developer Settings",
|
"developer_settings_label": "Developer Settings",
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import {
|
|||||||
useSetting,
|
useSetting,
|
||||||
} from "./settings/settings";
|
} from "./settings/settings";
|
||||||
import { useMediaDevices } from "./livekit/MediaDevicesContext";
|
import { useMediaDevices } from "./livekit/MediaDevicesContext";
|
||||||
import { useInitial } from "./useInitial";
|
|
||||||
|
|
||||||
type SoundDefinition = { mp3?: string; ogg: string };
|
type SoundDefinition = { mp3?: string; ogg: string };
|
||||||
|
|
||||||
@@ -53,11 +52,9 @@ function getPreferredAudioFormat(): "ogg" | "mp3" {
|
|||||||
return "mp3";
|
return "mp3";
|
||||||
}
|
}
|
||||||
|
|
||||||
type PrefetchedSounds<S extends string> = Promise<Record<S, ArrayBuffer>>;
|
const preferredFormat = getPreferredAudioFormat();
|
||||||
|
|
||||||
// We prefer to load these sounds ahead of time, so there
|
type PrefetchedSounds<S extends string> = Promise<Record<S, ArrayBuffer>>;
|
||||||
// is no delay on call join.
|
|
||||||
const PreferredFormat = getPreferredAudioFormat();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prefetch sounds to be used by the AudioContext. This should
|
* Prefetch sounds to be used by the AudioContext. This should
|
||||||
@@ -76,7 +73,7 @@ export async function prefetchSounds<S extends string>(
|
|||||||
// Use preferred format, fallback to ogg if no mp3 is provided.
|
// Use preferred format, fallback to ogg if no mp3 is provided.
|
||||||
// Load an audio file
|
// Load an audio file
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
PreferredFormat === "ogg" ? ogg : (mp3 ?? ogg),
|
preferredFormat === "ogg" ? ogg : (mp3 ?? ogg),
|
||||||
);
|
);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
// If the sound doesn't load, it's not the end of the world. We won't play
|
// If the sound doesn't load, it's not the end of the world. We won't play
|
||||||
@@ -92,7 +89,7 @@ export async function prefetchSounds<S extends string>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Props<S extends string> {
|
interface Props<S extends string> {
|
||||||
sounds: PrefetchedSounds<S>;
|
sounds: PrefetchedSounds<S> | null;
|
||||||
latencyHint: AudioContextLatencyCategory;
|
latencyHint: AudioContextLatencyCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,9 +110,12 @@ export function useAudioContext<S extends string>(
|
|||||||
const devices = useMediaDevices();
|
const devices = useMediaDevices();
|
||||||
const [audioContext, setAudioContext] = useState<AudioContext>();
|
const [audioContext, setAudioContext] = useState<AudioContext>();
|
||||||
const [audioBuffers, setAudioBuffers] = useState<Record<S, AudioBuffer>>();
|
const [audioBuffers, setAudioBuffers] = useState<Record<S, AudioBuffer>>();
|
||||||
const soundCache = useInitial(async () => props.sounds);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const soundList = props.sounds;
|
||||||
|
if (!soundList) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const ctx = new AudioContext({
|
const ctx = new AudioContext({
|
||||||
// We want low latency for these effects.
|
// We want low latency for these effects.
|
||||||
latencyHint: props.latencyHint,
|
latencyHint: props.latencyHint,
|
||||||
@@ -126,11 +126,10 @@ export function useAudioContext<S extends string>(
|
|||||||
// close during this process, so it's okay if it throws.
|
// close during this process, so it's okay if it throws.
|
||||||
(async (): Promise<void> => {
|
(async (): Promise<void> => {
|
||||||
const buffers: Record<string, AudioBuffer> = {};
|
const buffers: Record<string, AudioBuffer> = {};
|
||||||
for (const [name, buffer] of Object.entries(await soundCache)) {
|
for (const [name, buffer] of Object.entries<ArrayBuffer>(
|
||||||
const audioBuffer = await ctx.decodeAudioData(
|
await soundList,
|
||||||
// Type quirk, this is *definitely* a ArrayBuffer.
|
)) {
|
||||||
(buffer as ArrayBuffer).slice(0),
|
const audioBuffer = await ctx.decodeAudioData(buffer.slice(0));
|
||||||
);
|
|
||||||
buffers[name] = audioBuffer;
|
buffers[name] = audioBuffer;
|
||||||
}
|
}
|
||||||
setAudioBuffers(buffers as Record<S, AudioBuffer>);
|
setAudioBuffers(buffers as Record<S, AudioBuffer>);
|
||||||
@@ -145,7 +144,7 @@ export function useAudioContext<S extends string>(
|
|||||||
});
|
});
|
||||||
setAudioContext(undefined);
|
setAudioContext(undefined);
|
||||||
};
|
};
|
||||||
}, [soundCache, props.latencyHint]);
|
}, [props.sounds, props.latencyHint]);
|
||||||
|
|
||||||
// Update the sink ID whenever we change devices.
|
// Update the sink ID whenever we change devices.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user