I used simpl.info code as example. On their example I can see "TOSHIBA Web Camera - HD (13d3:5606)" in the "Video source" Select. Hence they can retrieve the label property of the sources. I can get the sources easily but the label is empty:
SourceInfo {facing: "", label: "", kind: "video", id: "0c2c5a2bf359a3ced6d7d39efe2f40477f50d5627df618a6f1998b5142437b27"}
Here is my code:
$(document).ready(function ()
{
if (navigator.getUserMedia)
{
if (typeof MediaStreamTrack.getSources !== 'undefined')
{
MediaStreamTrack.getSources(gotSources);
}
}
});
function gotSources(sourceInfos)
{
for (var i = 0; i < sourceInfos.length; i++)
{
var sourceInfo = sourceInfos[i];
if (sourceInfo.kind == 'video')
{
console.log(sourceInfo);
}
}
}
As stated in answer #4, the user must have already granted permission to the page to use the media devices in order to get the label
populated. When served over HTTPS, the browser will remember permission granted on subsequent loads, so the permission will have been granted before requesting media. When using HTTP, not HTTPS, the getUserMedia request must be made and accepted before MediaStreamTrack.getSources
will populate labels.
I tried simpl.info on another computer and as expected the label
was empty the first time, and populated after the second time.