<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [TOC] ## enumerateDevices 基本格式: ``` var ePromise = navigator.mediaDevices.enumerateDevices(); ``` ## MediaDevicesInfo | 屬性 | 說明 | | --- | --- | | deviceID | 設備ID | | label | 設備的名字 | | kind | 設備的種類 | | groupID | 兩個設備groupID相同,說明是同一個物理設備 | ## JavaScript中的Promise Promise -> 肯定執行 handle(resolve, reject) ``` then: on_resolve catch: on_reject ``` ## 代碼示例 client.js ``` 'use strict' var audioSource = document.querySelector('select#audioSource') var audioOutput = document.querySelector('select#audioOutput') var videoSource = document.querySelector('select#videoSource') if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices()){ console.log('emdiaDevices is not supported!'); }else { //navigator.mediaDevices.getUserMedia({audio: true, video: true}).then(r => handleError); navigator.mediaDevices.enumerateDevices() .then(gotDevices) .catch(handleError) } function gotDevices(deviceInfos) { deviceInfos.forEach(function (deviceInfo) { console.log(deviceInfo.kind + ": label = " + deviceInfo.label + ": id = " + deviceInfo.deviceId + ": groupId = " + deviceInfo.groupId); var option = document.createElement('option'); option.text = deviceInfo.label; option.value = deviceInfo.deviceId; if (deviceInfo.kind === 'audioinput') { audioSource.appendChild(option) }else if (deviceInfo.kind === 'audiooutput') { audioOutput.appendChild(option) }else if (deviceInfo.kind === 'videoinput') { videoSource.appendChild(option) } }); } function handleError(err) { console.log(err.name + ": " + err.message) } ``` client.html ``` <html> <head> <title> WebRtc get audio and video devices</title> </head> <body> <div> <label> audio input device:</label> <select id="audioSource"></select> </div> <div> <label> audio output device:</label> <select id="audioOutput"></select> </div> <div> <label> video input device:</label> <select id="videoSource"></select> </div> <script src="js/client.js"></script> </body> </html> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看