mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
Remove another debug line.
This commit is contained in:
@@ -24,21 +24,21 @@ type SoundDefinition = { mp3?: string; ogg: string };
|
|||||||
* @param volume The volume to play at.
|
* @param volume The volume to play at.
|
||||||
* @param ctx The context to play through.
|
* @param ctx The context to play through.
|
||||||
* @param buffer The buffer to play.
|
* @param buffer The buffer to play.
|
||||||
|
* @returns A promise that resolves when the sound has stopped playing.
|
||||||
*/
|
*/
|
||||||
function playSound(
|
async function playSound(
|
||||||
ctx: AudioContext,
|
ctx: AudioContext,
|
||||||
buffer: AudioBuffer,
|
buffer: AudioBuffer,
|
||||||
volume: number,
|
volume: number,
|
||||||
): void {
|
): Promise<void> {
|
||||||
if (!ctx || !buffer) {
|
logger.debug("Playing back sound");
|
||||||
return;
|
|
||||||
}
|
|
||||||
const gain = ctx.createGain();
|
const gain = ctx.createGain();
|
||||||
gain.gain.setValueAtTime(volume, 0);
|
gain.gain.setValueAtTime(volume, 0);
|
||||||
const src = ctx.createBufferSource();
|
const src = ctx.createBufferSource();
|
||||||
src.buffer = buffer;
|
src.buffer = buffer;
|
||||||
src.connect(gain).connect(ctx.destination);
|
src.connect(gain).connect(ctx.destination);
|
||||||
src.start();
|
src.start();
|
||||||
|
return new Promise<void>((r) => src.addEventListener("ended", () => r()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,7 +163,6 @@ export function useAudioContext<S extends string>(
|
|||||||
|
|
||||||
// Don't return a function until we're ready.
|
// Don't return a function until we're ready.
|
||||||
if (!audioContext || !audioBuffers) {
|
if (!audioContext || !audioBuffers) {
|
||||||
logger.debug("Audio not ready yet");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user