add voice activity detection

This commit is contained in:
makaveli10
2023-05-30 21:07:36 +05:30
parent 69eb8ae421
commit e37e7f5522
7 changed files with 75 additions and 8 deletions
+14 -1
View File
@@ -170,7 +170,8 @@ async function stopCapture() {
if (optionTabId) {
res = await sendMessageToTab(currentTabId, {
type: "STOP"
type: "STOP",
data: { currentTabId: currentTabId },
});
await removeChromeTab(optionTabId);
}
@@ -188,3 +189,15 @@ chrome.runtime.onMessage.addListener((message) => {
stopCapture();
}
});
/**
* Listens for if the tab is reloaded.
* @param {Object} message - The message received from the runtime.
*/
chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
if (changeInfo.status === 'complete') {
await executeScriptInTab(tabId, "content.js");
await delayExecution(500);
}
});