zoukankan      html  css  js  c++  java
  • 【webrtc】webrtc中音视频设备管理(9)


    //index.html中
    <!DOCTYPE html>
    <html>
    <head>
      <title>webrtc test</title>
    </head>
    <body>
      <script src="./js/client.js"></script>  
    </body>
    </html>
    
    
    
    //client.js中
    'use strict';
    
    if( !navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices ){
        console.log('enumerateDevices is not support!')
    }else{
        navigator.mediaDevices.enumerateDevices()
        .then(gotDevices)
        .catch(handleError);
    }
    
    function gotDevices(deviceInfos) {
        deviceInfos.forEach((deviceInfo) => {
            console.log(deviceInfo.kind + ':label = ' + deviceInfo.label + ':id = ' + deviceInfo.deviceId + ':groupId = ' + deviceInfo.groupId);
        });
    }
    
    function handleError (err){
        console.log(err);
    }
    

    目录结构

    示例github地址
  • 相关阅读:
    apns libcurl
    apns libcurl
    epoll
    epoll
    Linux服务器压测
    Linux服务器压测
    libevent
    libevent
    shell脚本
    shell脚本
  • 原文地址:https://www.cnblogs.com/smileyqp/p/12675307.html
Copyright © 2011-2022 走看看