You can try to use the chrome web-extension
background_pages.
It will listen to the service worker
and play the audio
The simple method for it would be to requesting the URL in the service worker and capture it in the background script using the chrome.webRequest
as mentioned in the link
chrome.webRequest.onBeforeRequest.addListener(
callback, filter, opt_extraInfoSpec);
as mentioned in this thread
Update
As mentioned in this link
Service Workers require a secure origin, such as HTTPS. chrome-extension:// pages are not HTTP/HTTPS, but are secure so this change becomes a necessary step to allow extensions to register a Service Worker.
"chrome-extension" is added as a scheme allowing service workers.
In the serviceworker script
First you need to register your extension in the manifest.json
- Request the url in the service worker
- Capture it in background script using the
chrome.webRequest.onBeforeRequest.addListener
- Play the sound in
background.js
and as mentioned by @Alexander currently there is no support for the sound in the MDN