Skip to content

Commit

Permalink
Add handling for "Recording in progress" message
Browse files Browse the repository at this point in the history
in stream.js and server.js
  • Loading branch information
infinitel8p committed Nov 13, 2023
1 parent 5fe520d commit 0f63921
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/public/js/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ ws.onmessage = function (event) {
console.log('Python script disconnected');
python_connected = false;
setTimeout(() => showMessageOnCanvas("Stream disconnected. Waiting for stream..."), 2000);
} else if (event.data === 'Recording in progress') {
console.log('Recording in progress');
setTimeout(() => showMessageOnCanvas("Recording in progress. Waiting for stream to resume..."), 2000);
} else if (python_connected) {
const blob = new Blob([event.data], { type: 'image/jpeg' });
const url = URL.createObjectURL(blob);
Expand Down
5 changes: 5 additions & 0 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ wss.on('connection', function connection(ws) {
return;
}

if (data.toString() === 'Recording in progress' && clientId === 'Python Script') {
broadcastData('Recording in progress', ws);
return;
}

// Regular message handling
broadcastData(data, ws);
});
Expand Down

0 comments on commit 0f63921

Please sign in to comment.