зеркало из https://github.com/nextcloud/spreed.git
Make joining the call synchronous
Joining a call was already partially synchronous (it waited until the media permissions were granted and the local media started), but it did not wait until the call was joined in the server. However, as the store is updated with the new call flags when "joinCall" returns the store was updated before the call was actually joined in the server. If the call status was fetched again from the server before the call was finally joined then the received status overwrote the one set locally. As whether the call view is shown or not is based on the call status this could cause the call view to be shown, then hidden, and then shown again once the call was finally joined. To prevent that now "joinCall" waits until the call was joined in the server, so the local call status always matches the call status in the server, and thus the call view is no longer shown, hidden and shown again. An alternative approach would have been to prefer the local call status over the one sent by the server. However, if the call view is shown before the call is joined in the server the call view is empty (there will be no other participant); from a user point of view it is clearer if joining the call shows a loading spinner in the button and takes some time than if the call view is shown with no other participant and no sign of joining the call still being in progress. Also, this makes joining the call behave similar to leaving it, as leaving the call was already synchronous. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Родитель
035a751c57
Коммит
993c5ac037
|
@ -96,6 +96,7 @@ async function connectSignaling(token) {
|
|||
|
||||
let pendingJoinCallToken = null
|
||||
let startedCall = null
|
||||
let failedToStartCall = null
|
||||
|
||||
function startCall(signaling, configuration) {
|
||||
let flags = PARTICIPANT.CALL_FLAG.IN_CALL
|
||||
|
@ -108,9 +109,11 @@ function startCall(signaling, configuration) {
|
|||
}
|
||||
}
|
||||
|
||||
signaling.joinCall(pendingJoinCallToken, flags)
|
||||
|
||||
startedCall()
|
||||
signaling.joinCall(pendingJoinCallToken, flags).then(() => {
|
||||
startedCall()
|
||||
}).catch(error => {
|
||||
failedToStartCall(error)
|
||||
})
|
||||
}
|
||||
|
||||
function setupWebRtc() {
|
||||
|
@ -162,6 +165,7 @@ async function signalingJoinCall(token) {
|
|||
|
||||
return new Promise((resolve, reject) => {
|
||||
startedCall = resolve
|
||||
failedToStartCall = reject
|
||||
|
||||
webRtc.startMedia(token)
|
||||
})
|
||||
|
|
Загрузка…
Ссылка в новой задаче