MicrosoftEdge / MicrosoftEdge/WebView2Feedback

How to set default camera in webview2?

Open
#789 5 comments 0 reactions 1 assignee View on GitHub

@champnic is already working on this.

Since Jan 6, 2021.

feature request tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

When a PC has multiple cameras,
how to set default camera and disable for Ask before accessing camera like Edge/Chrome browser?
image

Version
SDK: 1.0.721-prerelease
Runtime: 87.0.664.66 (64-bit)
Framework: WPF
OS: Win10

Sample html code to play the webcam video after page is loaded.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>SampleWebCam</title>
    <style>
        .vContainer {
            margin: 0px auto;
            width: 500px;
            height: 375px;
            border: 10px #333 solid;
        }
        #videoElement {
            width: 500px;
            height: 375px;
            background-color: #666;
        }
    </style>
</head>

<body>
    <div class="vContainer">
        <video id="videoElement" autoplay />
    </div>
    <script>
        const video = document.querySelector("#videoElement");
        if (navigator.mediaDevices.getUserMedia) {
            navigator.mediaDevices.getUserMedia({ video: true })
                .then(function (stream) {
                    video.srcObject = stream;
                })
                .catch(function (err0r) {
                    console.log("Something went wrong!");
                });
        }
    </script>
</body>
</html>

AB#39500192

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.