| Server IP : 158.247.231.215 / Your IP : 216.73.216.159 Web Server : Apache/2.4.41 (Ubuntu) System : Linux CTMS 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /mnt/blockstorage/vrlms_old/ |
Upload File : |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Teacher Dashboard</title>
</head>
<body>
<style>
#videoElement{
display: block;
width: 900px;
height: 602px
}
</style>
<h1>Teacher Dashboard</h1>
<button onclick="sendButtonClick('SceneA')">Load Level A</button>
<button onclick="sendButtonClick('SceneB')">Load Level B</button>
<button onclick="Pause()">Pause</button>
<img id="videoElement"></src>
<script>
const socket = new WebSocket('ws://training.contentsda.kr:3300');
// Connection opened
socket.addEventListener('open', (event) => {
console.log('WebSocket connection opened');
});
// Listen for messages from the server
socket.addEventListener('message', (event) => {
// console.log('Message from server:', event.data);
// Handle messages from the server as needed
});
// Listen for errors
socket.addEventListener('error', (event) => {
console.error('WebSocket encountered an error:', event);
});
// Listen for the connection to close
socket.addEventListener('close', (event) => {
console.log('WebSocket connection closed:', event);
});
function sendButtonClick(levelName) {
const classroomId = '123'; // Replace with the actual classroom ID
// Send a button click event to the WebSocket server
socket.send(JSON.stringify({ type: 'buttonClicked', payload: { classroomId, levelName } }));
}
function Pause() {
socket.send(JSON.stringify({ type: 'pause', payload: { } }));
}
const videoElement = document.getElementById('videoElement');
socket.onmessage = (event) => {
const imageData = JSON.parse(event.data).data;
// Convert the array of bytes to Uint8Array
const uint8Array = new Uint8Array(imageData);
// Convert Uint8Array to Blob
const blob = new Blob([uint8Array], { type: 'image/jpeg' });
// Create a data URL from the Blob
const dataUrl = URL.createObjectURL(blob);
// Display the image using an <img> element
const imageElement = document.getElementById('videoElement');
imageElement.src = dataUrl;
};
</script>
</body>
</html>