@@ -4,7 +4,7 @@ const videoElement = document.querySelector('video');
44const audioInputSelect = document . querySelector ( 'select#audioSource' ) ;
55const audioOutputSelect = document . querySelector ( 'select#audioOutput' ) ;
66const videoSelect = document . querySelector ( 'select#videoSource' ) ;
7- const selectors = [ audioInputSelect , audioOutputSelect , videoSelect ] ;
7+ const selectors = [ videoSelect ] ;
88
99let video = document . querySelector ( 'video' ) ;
1010let canvas = document . getElementById ( 'canvas' ) ;
@@ -22,16 +22,13 @@ function gotDevices(deviceInfos) {
2222 }
2323 } ) ;
2424 for ( let i = 0 ; i !== deviceInfos . length ; ++ i ) {
25+
2526 const deviceInfo = deviceInfos [ i ] ;
2627 const option = document . createElement ( 'option' ) ;
2728 option . value = deviceInfo . deviceId ;
28- if ( deviceInfo . kind === 'audioinput' ) {
29- option . text = deviceInfo . label || `microphone ${ audioInputSelect . length + 1 } ` ;
30- audioInputSelect . appendChild ( option ) ;
31- } else if ( deviceInfo . kind === 'audiooutput' ) {
32- option . text = deviceInfo . label || `speaker ${ audioOutputSelect . length + 1 } ` ;
33- audioOutputSelect . appendChild ( option ) ;
34- } else if ( deviceInfo . kind === 'videoinput' ) {
29+ console . log ( '[deviceInfo.label]' , deviceInfo . label ) ;
30+
31+ if ( deviceInfo . kind === 'videoinput' ) {
3532 option . text = deviceInfo . label || `camera ${ videoSelect . length + 1 } ` ;
3633 videoSelect . appendChild ( option ) ;
3734 } else {
@@ -45,7 +42,7 @@ function gotDevices(deviceInfos) {
4542 } ) ;
4643}
4744
48- navigator . mediaDevices . enumerateDevices ( ) . then ( gotDevices ) . catch ( handleError ) ;
45+ navigator . mediaDevices . enumerateDevices ( ) . then ( gotDevices )
4946
5047// Attach audio output device to video element using device/sink ID.
5148function attachSinkId ( element , sinkId ) {
0 commit comments