Is it possible to determine whether the browser tab is playing audio or not?

I’m looking for a way to determine if sound is playing on the tab of the current Chrome tab . I would like to emphasize that context is a web application and not an extension of chrome, not a single sound element . My guess is that the browser “knows” that the tab plays sound by displaying a sound icon in the tab title, so I assume there is some kind of HTML5 browser API for this.

+6
source share
1 answer

The simple answer is no

Long answer:

Something would be the best case in this context. Chrome has a browser-only API that connects to connected audio devices, but this cannot be used in a real environment. (source)

The chrome.audio API is provided so that users can receive information about and manage audio devices connected to the system. This API is currently only implemented for ChromeOS.

There is also an interesting solution to which Jared Son answers, the principle is that the plugin (should also be available on the Internet) views a web page for files that play audio. You can rewrite something like this for your web page (by capturing all possible sound sources and checking them individually). (source)

Perhaps the closest you can do is something like the MuteTab Chrome Extension (written by me, http://www.github.com/jaredsohn/mutetab ), which basically scans pages for objects, embed, audio , videos, and applet tags and hide them from the page. Sorry, this skips web audio

+2
source

Source: https://habr.com/ru/post/1011908/


All Articles