OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Media</title> |
| 5 <script> |
| 6 var micCount = 0; |
| 7 var cameraCount = 0; |
| 8 var combinedCount = 0; |
| 9 function gotMicrophone(stream) { |
| 10 micCount++; |
| 11 window.document.title = 'Mic count:' + micCount; |
| 12 } |
| 13 function gotCamera(stream) { |
| 14 cameraCount++; |
| 15 window.document.title = 'Camera count:' + cameraCount; |
| 16 } |
| 17 function gotCombined(stream) { |
| 18 combinedCount++; |
| 19 window.document.title = 'Combined count:' + combinedCount; |
| 20 } |
| 21 function errorCallback(error){ |
| 22 window.document.title = 'deny'; |
| 23 console.log('navigator.getUserMedia error: ', error); |
| 24 } |
| 25 function initiate_getMicrophone() { |
| 26 navigator.webkitGetUserMedia( |
| 27 {audio : true}, gotMicrophone, errorCallback); |
| 28 } |
| 29 function initiate_getCamera() { |
| 30 navigator.webkitGetUserMedia( |
| 31 {video : true}, gotCamera, errorCallback); |
| 32 } |
| 33 function initiate_getCombined() { |
| 34 navigator.webkitGetUserMedia( |
| 35 {video : true, audio: true}, gotCombined, errorCallback); |
| 36 } |
| 37 </script> |
| 38 </head> |
| 39 <body> |
| 40 </body> |
| 41 </html> |
OLD | NEW |