9951 explained code solutions for 126 technologies


chrome-extensionHow to play sound


var sound = new Audio(chrome.runtime.getURL('sound.mp3'));
sound.play();ctrl + c
var sound

audio object to play mp3

chrome.runtime.getURL

get URL for public extension resource (mp3 file in our case)

sound.mp3

file we want to play (should be located in extension folder and added to web_accessible_resources)

sound.play()

plays selected file