簡體   English   中英

麥克風訪問 Microsoft Edge

[英]Microphone access Microsoft Edge

我有下一個在 Chrome 中運行良好的代碼:

<!DOCTYPE html>
    <a href="Default.html">Default.html</a>
    <head>
    <meta charset="utf-8"/>
    <title></title>
    <script type="text/javascript">
        if (navigator.getUserMedia) {
            navigator.getUserMedia(
            // constraints
            {
                video: true,
                audio: true
            },
            // successCallback
            function (localMediaStream) {
                var video = document.querySelector('video');
                video.src = window.URL.createObjectURL(localMediaStream);
                // do whatever you want with the video
                video.play();
            },
            // errorCallback
            function (err) {
                console.log("The following error occured: " + err);
            });
        } else {
            alert("getUserMedia not supported by your web browser or Operating system version");
        }
    </script>
    </head>
    <body>
        <h2>Media Capture and Streaming</h2>
        <p>Let's stream our video!</p>
        <video autoplay></video>
    </body>
</html>

但是我對 Edge 有問題,因為在每個頁面刷新 Edge 都會詢問新的“允許阻止麥克風請求”。 是否可以像在 Chrome 中一樣在 Edge 中使其永久化? 因為我知道這個功能在 Chrome 中永久有效的網站,你不需要每次都允許訪問。

使用 SSL(https) 解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM