Uncaught ReferenceError: Audio is not defined

1.3k views Asked by At

Heyo, I wanted to publish an extention to the google store but I couldn't with manifest v2.

Currently trying to migrate to v3 but i'm getting Uncaught ReferenceError: Audio is not defined in my background.js.

Only using JS / HTML / CSS

EDIT : I also have a "Service worker registration failed" warning, might be related to that?

EDIT 2 : Seems to only have this problem when chrome starts. If i'm clicking on the extension's icon that opens the default popup everything is fine after that.

Is there a way to make it popup at the start of chrome or a way to fix that?

manifest.json

{
"manifest_version": 3,
"name": "test name", 
"description": "test description", 
"version": "0.1", 
"action": {   
 "default_popup": "index.html" 
},
"icons": { 
 "64" : "img/x.png" 
},
"background": {
"service_worker": "background.js"
},
"permissions": [
  "storage",
  "notifications"
]

}

background.js

notifsoundLive = "/mp3/barou.wav";
soundnotif = 0;


// Volume

var son = new Audio(notifsoundLive);

son.volume = .5;
0

There are 0 answers