记录后如何取消getUserMedia指示 [英] How to cancel getUserMedia indicator after recording
问题描述
我使用 recorder.js 和 getUserMedia
做在浏览器中录制一些音频。开始录制时,用户会收到允许此网站使用您的麦克风提示,一旦他们点击允许,Chrome会在标签的图标上添加一个指示器,以显示它正在录制:
录制指标http://ubuntuone.com/1nBkbmc9vA313WeWtV03Kz
我的问题是,即使在我的应用程序停止录制后,指示器也不会消失。基本上,我想撤销我自己的录制权限。这是可能的吗?
当您生成新的 MediaStream
它包含一个 MediaStreamTrack
对象。
$ b 调用 MediaStream.getAudioTracks()
应该返回一个表示所有 MediaStreamTrack
类中的对象,类型为audio
。在调用 MediaStream.getVideoTracks()
来检索视频轨道对象时,同样的情况也适用。 b
$ b
根据规范,看起来像你可以通过在音轨对象上调用 MediaStreamTrack.stop()
来撤销对你的应用的所有权限。
资料来源: Media Capture和Stream API规范
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?
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
这篇关于记录后如何取消getUserMedia指示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!