Question
I'd like to know whether an <iframe>
that is embedded in my website is playing audio.
Ideally as well how "loud" the <iframe>
is playing the audio but that's optional.
Note that the <iframe>
is not on the same origin, hence inspecting the <iframe>
is not an option.
My Concrete Use Case
I'm the developer of https://www.timer-tab.com/ and when the time is up a YouTube video starts playing. The YouTube video is playing in an <iframe>
. I'd like to know whether the YouTube <iframe>
is emitting any sound. If it doesn't emit any sound, a fallback sound is played using the Web Audio API. (The YouTube <iframe>
sometimes doesn't emit sound. For example, when the user has set his YouTube volume setting to mute. Unfortunately, it is not possible to get that information by postMessage
ing the YouTube <iframe>
.)
Related Question
Detect if audio is playing in browser Javascript.
This is not a duplicated; my question asks specifically for <iframe>
audio detection whereas the related questions asks for all audio detection.