| <!DOCTYPE html> | |
| <!-- | |
| Copyright 2022 The Chromium Authors | |
| Use of this source code is governed by a BSD-style license that can be | |
| found in the LICENSE file. | |
| --> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>Requesting Camera Permissions</title> | |
| </head> | |
| <body> | |
| <div id="container"> | |
| <video autoplay="true" id="videoElement" width="480px" height="270px" playsinline> | |
| </video> | |
| </div> | |
| <script type="text/javascript"> | |
| var video = document.querySelector("#videoElement"); | |
| navigator.mediaDevices.getUserMedia({ video: true }) | |
| .then(function(stream) { | |
| video.srcObject = stream; | |
| }); | |
| </script> | |
| </body> | |
| </html> |