从浏览器捕获系统声音 [英] Capture system sound from browser
问题描述
我想知道是否可以捕捉系统的声音。
有没有办法从浏览器中捕捉系统声音(不仅仅是麦克风)。也许一个扩展?
在Chrome中,包括系统音频(但仅在Windows和Chrome操作系统上 和没有OS X或Linux的计划) 。例如
chrome.desktopCapture.chooseDesktopMedia([$ b $'screen','window' //('tab'不被支持;使用chrome.tabCapture来代替)
],function(streamId){
navigator.webkitGetUserMedia({
audio:{
mandatory:{
chromeMediaSource:'system',
chromeMediaSourceId:streamId
}
},
video:false,//我们现在只想要音频
} ,函数(stream){
//用这个MediaStream来做你想做的事
},函数(error){
//处理错误
});
});
我不确定Firefox是否可以捕捉系统声音,但至少它能够捕获一些输出(选项卡/窗口/浏览器/操作系统?)。
首先您需要访问 about:config
并将 media.getusermedia.audiocapture.enabled
设置为 true
(这可以通过Firefox附件自动完成)。然后可以捕获流如下:
$ b
navigator.mozGetUserMedia({
audio :{
mediaSource:'audioCapture'
},
video:false,//只是显式的,我们现在只想要音频
},函数(stream){
//用这个MediaStream做你想做的事
},function(error){
//处理错误
});
这是在Firefox 42中的 https://bugzilla.mozilla.org/show_bug.cgi?id=1156472
I am trying to build a web app that captures both local and remote audios from a webrtc call, but I can`t record the remote audio(using recordRTC). I was wondering if I could capture the system sound somehow.
Is there a way to capture the system sound (not just the mic) from the browser. Maybe an extension?
In Chrome, the chrome.desktopCapture
extension API can be used to capture the screen, which includes system audio (but only on Windows and Chrome OS and without plans for OS X or Linux). E.g.
chrome.desktopCapture.chooseDesktopMedia([
'screen', 'window' // ('tab' is not supported; use chrome.tabCapture instead)
], function(streamId) {
navigator.webkitGetUserMedia({
audio: {
mandatory: {
chromeMediaSource: 'system',
chromeMediaSourceId: streamId
}
},
video: false, // We only want audio for now.
}, function(stream) {
// Do what you want with this MediaStream.
}, function(error) {
// Handle error
});
});
I'm not sure whether Firefox can capture system sound, but at the very least it is capable of capturing some output (tab/window/browser/OS?).
First you need to visit about:config
and set media.getusermedia.audiocapture.enabled
to true
(this could be automated through a Firefox add-on). Then the stream can be captured as follows:
navigator.mozGetUserMedia({
audio: {
mediaSource: 'audioCapture'
},
video: false, // Just being explicit, we only want audio for now
}, function(stream) {
// Do what you want with this MediaStream.
}, function(error) {
// Handle error
});
This was implemented in Firefox 42, at https://bugzilla.mozilla.org/show_bug.cgi?id=1156472
这篇关于从浏览器捕获系统声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!