Is there any way to detect whether a certain page is making noise using jscript? Some sort of environmental variable or something that tracks the status of the speakers? I'm attempting to write a script that puts an icon on the Tab Title if that Tab is making sound.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- Can we recover audio from MFCC coefficients?
- void before promise syntax
- Keeping track of variable instances
No, this isn't possible.
Lots of plugins can make sound, and they all do it in their own way. There is no catch-all here.
Perhaps on Vista/7 where applications sound usage is actually kept track of, and when using a browser like Chrome that makes a separate process for each page, you might have more luck. It would involve figuring out which processes are playing sound, then figuring out what page each process had loaded. Through JavaScript though? No way.
I don't think you can detect whether or not the speakers are making noise in JavaScript, however you may not have to.
Perhaps you could keep track of this yourself, implicitly. So for example, if there is a play button, on click you could start playing the audio and show the icon. Once the user clicks the stop button, you stop the audio and hide the icon.
This can help you,
fbc_array
is de array noise usefbc_array[value]
for get this noise. example:Scraped from Quora
(Pay no attention to the comment below (in the linked Quora question) saying Chrome displays a 'play' icon when sound is played. That's Soundcloud changing the title of its own page, not Google Chrome)