最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to cancel getUserMedia indicator after recording - Stack Overflow

programmeradmin6浏览0评论

I'm using the recorder.js and getUserMedia to do some audio recording in the browser. When starting the recording, the user is given the "Allow this site to use your microphone" prompt, and once they click allow, Chrome adds an indicator onto the tab's favicon to show that it is recording:


(source: ubuntuone)

My issue is that the indicator never goes away, even after my application has stopped recording. Basically, I'd like to revoke my own recording permissions. Is this possible?

I'm using the recorder.js and getUserMedia to do some audio recording in the browser. When starting the recording, the user is given the "Allow this site to use your microphone" prompt, and once they click allow, Chrome adds an indicator onto the tab's favicon to show that it is recording:


(source: ubuntuone.)

My issue is that the indicator never goes away, even after my application has stopped recording. Basically, I'd like to revoke my own recording permissions. Is this possible?

Share Improve this question edited Aug 27, 2021 at 18:34 Glorfindel 22.7k13 gold badges89 silver badges119 bronze badges asked Jul 22, 2013 at 9:19 nickfnickf 547k199 gold badges658 silver badges727 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 12

When you generate a new MediaStream object from a getUserMedia call, it contains a MediaStreamTrack object.

Calling MediaStream.getAudioTracks() should return a sequence that represents a snapshot of all the MediaStreamTrack objects in the stream with the kind "audio". Same thing applies when calling MediaStream.getVideoTracks() to retrieve video track objects.

According to the spec, it looks like you can revoke all given permissions to your app by calling MediaStreamTrack.stop() on the audio track object.

Source: Media Capture and Stream API spec

发布评论

评论列表(0)

  1. 暂无评论