简体   繁体   中英

Javascript detect audio recording

I'm building a chrome extension and I would like to detect when the current page starts an audio recording using a content script that gets injected into the current page from the extension.

I don't have access to the audio stream, nor the MediaRecorder objects (these are handled separately by the page itself, has nothing to do with the extension), and was wondering if there's any callback/event I could hook into in order to observe these events: start recording and stop recording.

Since the Chrome tab changes appearance when the recording is started and when it is stopped, I was thinking there are certain events I could monitor so I can know if a recording has started or has stopped.

Any help is much appreciated.

https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder_API

There is the dataavailable event you can listen to, but that only fires after the audio has been recorded.

There seems to be no event to indicate when the recording starts.

You could add a feature request to chrome to have this event available for plugin devs.

You can also download the source of chromium to see what happens internally the moment audio recording starts and see if you can capture one of those changes somehow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM