【WebRtc】获取媒体设备信息

加载设备信息页面

image.png

加载完设备信息页面

image.png

Code

 /**
     * 加载当前设备的音视频信息
     */
    initInnerLocalDevice() {
      let that = this;
      // 判断是否支持
      if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
        that.$notify({
          title: '警告',
          message: '浏览器不支持获取媒体设备',
          type: 'warning'
        });
        return;
      }
      this.loading = true
      navigator.mediaDevices.enumerateDevices()
          .then(devices => {
            devices.forEach(function (device) {
              let obj = {id: device.deviceId, kind: device.kind, label: device.label}
              if (device.kind === 'audioinput') {
                if (that.audioInArray.filter(e => e.id === device.deviceId).length === 0) {
                  that.audioInArray.push(obj)
                }
              } else if (device.kind === 'audiooutput') {
                if (that.audioOutArray.filter(e => e.id === device.deviceId).length === 0) {
                  that.audioOutArray.push(obj)
                }
              } else if (device.kind === 'videoinput') {
                if (that.videoOutArray.filter(e => e.id === device.deviceId).length === 0) {
                  that.videoOutArray.push(obj)
                }
              }
            });
            this.loading = false
          }).catch(this.handleError);
    }

期待更新,麻烦点个赞,点个关注,栓Q !

本文作者:Hello、Lin

本文链接:https://www.cnblogs.com/HelloWxl/p/17203772.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   Hello、Lin  阅读(50)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
  1. 1 404 not found REOL
404 not found - REOL
00:00 / 00:00
An audio error has occurred.