SEBWIN-475: Moved leave instruction to window close event.

This commit is contained in:
Damian Büchel 2021-07-07 11:31:55 +02:00
parent b67716b724
commit 0a2b1670d4
3 changed files with 8 additions and 15 deletions

View file

@ -57,6 +57,10 @@
} }
} }
window.addEventListener('unload', () => {
api.executeCommand('hangup');
api.dispose();
});
window.chrome.webview.addEventListener('message', webMessageReceived); window.chrome.webview.addEventListener('message', webMessageReceived);
window.chrome.webview.postMessage('credentials'); window.chrome.webview.postMessage('credentials');
</script> </script>

View file

@ -9,7 +9,6 @@
using System; using System;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Threading;
using System.Windows; using System.Windows;
using Microsoft.Web.WebView2.Wpf; using Microsoft.Web.WebView2.Wpf;
using SafeExamBrowser.Configuration.Contracts; using SafeExamBrowser.Configuration.Contracts;
@ -215,17 +214,6 @@ namespace SafeExamBrowser.Proctoring
{ {
control.Dispatcher.Invoke(() => control.Dispatcher.Invoke(() =>
{ {
if (settings.JitsiMeet.Enabled)
{
control.ExecuteScriptAsync("api.executeCommand('hangup'); api.dispose();");
}
else if (settings.Zoom.Enabled)
{
control.ExecuteScriptAsync("ZoomMtg.leaveMeeting({});");
}
Thread.Sleep(2000);
window.Close(); window.Close();
control = default(ProctoringControl); control = default(ProctoringControl);
window = default(IProctoringWindow); window = default(IProctoringWindow);

View file

@ -17,7 +17,7 @@
var audioJoin = 0; var audioJoin = 0;
var videoJoin = 0; var videoJoin = 0;
function initializeUserInterface(_) { function controlUserInterface(_) {
var audioButton = document.getElementsByClassName('join-audio-by-voip__join-btn')[0]; var audioButton = document.getElementsByClassName('join-audio-by-voip__join-btn')[0];
var audioContainer = document.getElementsByClassName('join-audio-container')[0]; var audioContainer = document.getElementsByClassName('join-audio-container')[0];
var leave = document.getElementsByClassName('footer__leave-btn-container')[0]; var leave = document.getElementsByClassName('footer__leave-btn-container')[0];
@ -61,7 +61,7 @@
videoContainer.style.visibility = 'hidden'; videoContainer.style.visibility = 'hidden';
} }
requestAnimationFrame(initializeUserInterface); requestAnimationFrame(controlUserInterface);
} }
function startMeeting(credentials) { function startMeeting(credentials) {
@ -136,7 +136,7 @@
alert(`Failed to join meeting: ${JSON.stringify(res)}`); alert(`Failed to join meeting: ${JSON.stringify(res)}`);
}, },
success: function (res) { success: function (res) {
requestAnimationFrame(initializeUserInterface); requestAnimationFrame(controlUserInterface);
} }
}); });
} }
@ -149,6 +149,7 @@
} }
} }
window.addEventListener('unload', () => ZoomMtg.leaveMeeting({}));
window.chrome.webview.addEventListener('message', webMessageReceived); window.chrome.webview.addEventListener('message', webMessageReceived);
window.chrome.webview.postMessage('credentials'); window.chrome.webview.postMessage('credentials');
</script> </script>