1
0
mirror of https://github.com/elisspace/AskAssist.git synced 2026-08-29 15:33:47 +00:00

add sound interruption

This commit is contained in:
Jeremy Dixon
2021-01-22 16:29:59 -06:00
parent f7909eb550
commit 1044619c9b

View File

@@ -5,6 +5,7 @@ let time=1000;
let timer = setInterval(()=>{
if(started){time++}
},1000);
let currSound;
chrome.runtime.onMessage.addListener((request, sender, sendResponse)=>{
console.log(request);
@@ -65,7 +66,9 @@ let alert_manager = {
console.log('Playing Alert')
alert = new Audio(chrome.runtime.getURL(`./assets/sounds/${alertFile}.mp3`));
alert.volume = (1/5)*options["volume"];
alert.play();
if(currSound){currSound.pause()}
currSound = alert;
currSound.play();
started = true;
time = 0;
}