0
我試圖啓用和禁用我的麥克風,但我真的無法得到它的工作,我是新來的JavaScript。JS啓用和禁用麥克風
使用的WebRTC
navigator.getUserMedia({"audio":USE_AUDIO},
function(stream) { /* user accepted access to a/v */
console.log("Access granted to audio/video");
local_media_stream = stream;
var local_media = $("<audio>");
local_media.attr("autoplay", "autoplay");
local_media.attr("muted", "true"); /* always mute ourselves by default */
local_media.attr("controls", "");
$('body').append(local_media);
attachMediaStream(local_media[0], stream);
if (callback) callback();
$('.testHold').mousedown(function() {
$('.tracker').html("holding holding holding");
local_media.attr("muted", "false");
}).bind('mouseup mouseleave', function() {
$('.tracker').text('Left the button');
local_media.attr("muted", "true");
});
}