mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
48e7a0e25f
* cleanup unused convo json fields in db * display a toast if the user is not approved yet on call OFFER received * enable CBR for calls * do not update active_at on configMessage if !!active_at * remove mkdirp dependency * disable call button if focused convo is blocked * quote: do not include the full body in quote, but just the first 100 * click on the edit profile qr code padding * Allow longer input for opengroup join overlay Fixes #2068 * Fix overlay feature for start new session button * make ringing depend on redux CALL status * turn ON read-receipt by default
35 lines
743 B
TypeScript
35 lines
743 B
TypeScript
const sound = './sound/ringing.mp3';
|
|
|
|
let currentlyRinging = false;
|
|
|
|
let ringingAudio: HTMLAudioElement | undefined;
|
|
|
|
function stopRinging() {
|
|
if (ringingAudio) {
|
|
ringingAudio.pause();
|
|
ringingAudio.srcObject = null;
|
|
}
|
|
}
|
|
|
|
function startRinging() {
|
|
if (!ringingAudio) {
|
|
ringingAudio = new Audio(sound);
|
|
ringingAudio.loop = true;
|
|
ringingAudio.volume = 0.6;
|
|
}
|
|
void ringingAudio.play().catch(window.log.info);
|
|
}
|
|
|
|
export function getIsRinging() {
|
|
return currentlyRinging;
|
|
}
|
|
|
|
export function setIsRinging(isRinging: boolean) {
|
|
if (!currentlyRinging && isRinging) {
|
|
startRinging();
|
|
currentlyRinging = true;
|
|
} else if (currentlyRinging && !isRinging) {
|
|
stopRinging();
|
|
currentlyRinging = false;
|
|
}
|
|
}
|