How to cancel getUserMedia indicator after recording

岁酱吖の 提交于 2019-12-08 16:37:21

问题


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:

Recording indicator http://ubuntuone.com/1nBkbmc9vA313WeWtV03Kz

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?


回答1:


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



来源:https://stackoverflow.com/questions/17783805/how-to-cancel-getusermedia-indicator-after-recording

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!