Skip to content

Instantly share code, notes, and snippets.

@olamedia
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olamedia/06611f18cae65101335c to your computer and use it in GitHub Desktop.
Save olamedia/06611f18cae65101335c to your computer and use it in GitHub Desktop.
var audioSource = "",videoSource = "";
function gotSources(sourceInfos) {
for (var i = 0; i !== sourceInfos.length; ++i) {
var sourceInfo = sourceInfos[i];
//var option = document.createElement('option');
//option.value = sourceInfo.id;
if (sourceInfo.kind === 'audio') {
//option.text = sourceInfo.label || 'microphone ' + (audioSelect.length + 1);
audioSource = sourceInfo.id;
console.log("mic:"+sourceInfo.id);
//audioSelect.appendChild(option);
} else if (sourceInfo.kind === 'video') {
videoSource = sourceInfo.id;
//option.text = sourceInfo.label || 'camera ' + (videoSelect.length + 1);
//videoSelect.appendChild(option);
} else {
console.log('Some other kind of source: ', sourceInfo);
}
}
}
if (typeof MediaStreamTrack === 'undefined'){
alert('This browser does not support MediaStreamTrack.\n\nTry Chrome Canary.');
} else {
MediaStreamTrack.getSources(gotSources);
}
var constraints = {
audio: {
optional: [
{googEchoCancellation:true},
{googAutoGainControl:true},
{googNoiseSuppression:true},
{googHighpassFilter:true},
{googAudioMirroring:false},
{googNoiseSuppression2:true},
{googEchoCancellation2:true},
{googAutoGainControl2:true},
{googDucking:false},
{sourceId:audioSource},
{chromeRenderToAssociatedSink:true}
]
},
video: {
optional: [
{sourceId: videoSource},
{googNoiseReduction: true},
{googLeakyBucket: true},
{maxWidth: 100},
{maxHeight: 75},
{minFrameRate: 30},
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment