I'd like to execute a console command on a specific tab and receive a boolean answer whether the tab is playing audio. (Usually stated as a little speaker icon near the tab's title)
Can this be done?
Visit the tabs tray by tapping the number next to the address bar: You'll see your open tabs. Look for the pause icon on the tab list to see which tabs are playing audio. This icon is a button that allows you to stop the sound.
Just click the icon in the top right corner of Chrome on desktop, open the new media hub and manage what's playing from there.
Chrome. Google's browser displays a little speaker icon on any tab that is currently playing audio. To mute the audio for a tab, right-click the tab and choose Mute site. You can perform this maneuver without leaving your current tab.
Shazam, SoundHound & Music Recognition Apps Shazam: Available for both Android and iOS users, this one of the most popular song recognition apps on the market. After downloading the app to your device, you can easily ask it what song is playing and get the song details.
You can detect if a Chrome tab is playing audio with a Chrome Extension, using the chrome.tabs API. The API provides a boolean audible
property, as described below:
Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted). Equivalent to whether the speaker audio indicator is showing.
Source: https://developer.chrome.com/extensions/tabs
There's no way to access the tabs from the console itself, as it is run from the context of the current page. In the background page of a Chrome Extension, you have access to all the tabs, and you can query them using the API outlined above. Your extension can simply provide a panel that displays a list of all the open tabs and a flag to say whether the audio is playing.
Aside: If you just want to quickly mute HTML5 Audio/Video in the current tab using the Chrome console, you can run the following (the $$
is equivalent to document.querySelectorAll()
):
$$('video', 'audio').forEach((element) => element.muted = true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With