add multilingual, language & task option in Firefox extension

This commit is contained in:
makaveli10
2023-07-17 22:13:34 +05:30
parent f6dce0e008
commit 82a4c93019
4 changed files with 194 additions and 8 deletions
+10 -4
View File
@@ -38,10 +38,16 @@ function resampleTo16kHZ(audioData, origSampleRate = 44100) {
return resampledData;
}
function startRecording(host, port) {
socket = new WebSocket(`ws://${host}:${port}/`);
function startRecording(data) {
socket = new WebSocket(`ws://${data.host}:${data.port}/`);
socket.onopen = function(e) {
socket.send("handshake");
socket.send(
JSON.stringify({
multilingual: data.useMultilingual,
language: data.language,
task: data.task
})
);
};
let isServerReady = false;
@@ -209,7 +215,7 @@ browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
const { action, data } = request;
if (action === "startCapture") {
isCapturing = true;
startRecording(data.host, data.port);
startRecording(data);
} else if (action === "stopCapture") {
isCapturing = false;