Trong Chrome, API chrome.desktopCapture
mở rộng có thể được sử dụng để chụp màn hình, mà includes system audio (nhưng only on Windows and Chrome OS và without plans for OS X or Linux). Ví dụ.
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
});
});
Tôi không chắc liệu Firefox có thể thu âm hệ thống hay không, nhưng ít nhất nó có khả năng thu được một số đầu ra (tab/window/browser/OS?). Trước tiên, bạn cần truy cập about:config
và đặt media.getusermedia.audiocapture.enabled
thành true
(điều này có thể được tự động thông qua tiện ích bổ sung của Firefox). Sau đó, các dòng có thể được chụp như sau:
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
});
này được thực hiện trong Firefox 42, tại https://bugzilla.mozilla.org/show_bug.cgi?id=1156472
Nguồn
2015-12-12 12:01:20
Firefox addon làm việc ở đây - https://www.webrtc-experiment.com/RecordRTC/ - chỉ addon cần thiết cho danh sách trắng một miền. – Noitidart