diff --git a/src/lib/components/calling/CallScreen.svelte b/src/lib/components/calling/CallScreen.svelte
index 86094c1e0..72e8412d1 100644
--- a/src/lib/components/calling/CallScreen.svelte
+++ b/src/lib/components/calling/CallScreen.svelte
@@ -13,7 +13,7 @@
import type { Chat } from "$lib/types"
import VolumeMixer from "./VolumeMixer.svelte"
import { createEventDispatcher, onDestroy, onMount } from "svelte"
- import { callTimeout, TIME_TO_SHOW_CONNECTING, TIME_TO_SHOW_END_CALL_FEEDBACK, usersAcceptedTheCall, usersDeniedTheCall, VoiceRTCInstance } from "$lib/media/Voice"
+ import { callTimeout, TIME_TO_SHOW_CONNECTING, TIME_TO_SHOW_END_CALL_FEEDBACK, timeCallStarted, usersAcceptedTheCall, usersDeniedTheCall, VoiceRTCInstance } from "$lib/media/Voice"
import { log } from "$lib/utils/Logger"
import { playSound, SoundHandler, Sounds } from "../utils/SoundHandler"
@@ -127,10 +127,18 @@
}
let showAnimation = true
+ let noResponseVisible = false
let message = $_("settings.calling.connecting")
let timeout: NodeJS.Timeout | undefined
+ let hideNoResponseUsersTimeout: NodeJS.Timeout | undefined
let callSound: SoundHandler | undefined = undefined
+ function hideNoResponseUsersAfterAPeriodOfTime() {
+ hideNoResponseUsersTimeout = setTimeout(() => {
+ noResponseVisible = false
+ }, 10000)
+ }
+
$: if ($usersAcceptedTheCall.length > 0) {
callSound?.stop()
callSound = undefined
@@ -152,9 +160,24 @@
callSound = undefined
showAnimation = false
message = $_("settings.calling.noResponse")
+ noResponseVisible = true
+ hideNoResponseUsersAfterAPeriodOfTime()
}, TIME_TO_SHOW_CONNECTING)
}
}
+ if ($timeCallStarted) {
+ let timeCallStartedInterval = setInterval(() => {
+ let now = new Date()
+ let timeDifference = now.getTime() - $timeCallStarted.getTime()
+ if (timeDifference > TIME_TO_SHOW_CONNECTING) {
+ showAnimation = false
+ noResponseVisible = true
+ message = $_("settings.calling.noResponse")
+ clearInterval(timeCallStartedInterval)
+ hideNoResponseUsersAfterAPeriodOfTime()
+ }
+ }, 1000)
+ }
if (VoiceRTCInstance.localVideoCurrentSrc) {
await VoiceRTCInstance.getLocalStream(true)
@@ -174,6 +197,9 @@
if (timeout) {
clearTimeout(timeout)
}
+ if (hideNoResponseUsersTimeout) {
+ clearTimeout(hideNoResponseUsersTimeout)
+ }
callSound?.stop()
callSound = undefined
})
@@ -214,7 +240,7 @@
{#each chat.users as user (user)}
{#if user === get(Store.state.user).key && !userCallOptions.video.enabled}
{$_("settings.calling.acceptedCall")}
{message}
diff --git a/src/lib/media/Voice.ts b/src/lib/media/Voice.ts index e1f8cda2e..0538a1759 100644 --- a/src/lib/media/Voice.ts +++ b/src/lib/media/Voice.ts @@ -16,16 +16,17 @@ export const TIME_TO_SHOW_END_CALL_FEEDBACK = 3500 export const TIME_TO_SHOW_CONNECTING = 30000 let timeOuts: NodeJS.Timeout[] = [] + export const usersDeniedTheCall: Writable