Skip to content
Snippets Groups Projects
Unverified Commit 8d720b54 authored by Marius Friess's avatar Marius Friess Committed by GitHub
Browse files

Listen for websocket event when browser is closed (#74)

parent 47161cd2
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,7 @@
</button>
<button
v-if="isTeacher"
@click="closeWebsite"
@click="closeBrowser"
:disabled="!isStreaming"
class="btn btn-sm ms-2"
>
......@@ -145,8 +145,8 @@
/**
* Closes the currently opened website using the browser channel. It also resets the streaming and video source.
*/
function closeWebsite() {
channel.browser.closeWebsite();
function closeBrowser() {
channel.browser.closeBrowser();
isStreaming.value = false;
browserVideo.value!.srcObject = null;
}
......
......@@ -39,6 +39,10 @@ export const useBrowser = () => {
loadBrowserStream();
});
socket.on('close-browser', () => {
browserStream.value = null;
});
socket.on('browser-url', (newUrl: string) => {
setUrl(newUrl);
});
......@@ -74,11 +78,11 @@ export const useBrowser = () => {
}
/**
* Closes the website on the browser
* Closes the browser
*/
function closeWebsite() {
function closeBrowser() {
browserStream.value = null;
socket?.emit('close-website');
socket?.emit('close-browser');
}
/**
......@@ -158,7 +162,7 @@ export const useBrowser = () => {
loadBrowserStream,
setUrl,
openWebsite,
closeWebsite,
closeBrowser,
moveMouse,
mouseDown,
mouseUp,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment