add option to use collabora server

This commit is contained in:
makaveli10
2023-07-13 00:59:48 +05:30
parent 7accea1fdf
commit a634a6d6d3
10 changed files with 109 additions and 13 deletions
+3 -4
View File
@@ -1,4 +1,3 @@
console.log("Content script injected.");
let socket = null;
let isCapturing = false;
let mediaStream = null;
@@ -39,8 +38,8 @@ function resampleTo16kHZ(audioData, origSampleRate = 44100) {
return resampledData;
}
function startRecording() {
socket = new WebSocket("ws://localhost:9090/");
function startRecording(host, port) {
socket = new WebSocket(`ws://${host}:${port}/`);
socket.onopen = function(e) {
socket.send("handshake");
};
@@ -210,7 +209,7 @@ browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
const { action, data } = request;
if (action === "startCapture") {
isCapturing = true;
startRecording();
startRecording(data.host, data.port);
} else if (action === "stopCapture") {
isCapturing = false;