Android移动浏览器-navigator.mediaDevices.enumerateDevices方法返回交换的音频输入和输出设备值

时间:2020-04-02 14:35:44

标签: javascript android google-chrome webrtc mobile-development

我正在使用导航器功能-navigator.mediaDevices.enumerateDevices()在移动浏览器应用程序中获取媒体设备列表。我正在使用以下代码:

navigator.mediaDevices.enumerateDevices().then(function(devices) {
 console.log("devices", devices);
});

我正在交换音频输入和音频输出设备对象值,如下所示:

[
  {
    "deviceId": "default",
    "kind": "audioinput",
    "label": "Default",
    "groupId": "41a111f571a1171ca91c5428d2ad8806a66bb6d7c5812f779161151a706641a1"
  },
  {
    "deviceId": "bbf2c347dbfc70b9e37b16be622c4973a74269c7f53d4162adab0c09614514d1",
    "kind": "audioinput",
    "label": "Speakerphone",
    "groupId": "e8dc20cc0a8dd33f65085c2f06bb8424105eb230c54237c343b8f8ff960559f3"
  },
  {
    "deviceId": "704cd1e8449390f5bb3fd1615a7637753f4ad019d4e6bb3f7c36690f58f2536d",
    "kind": "audioinput",
    "label": "Headset earpiece",
    "groupId": "1f2f370cbbe3f57fe3a8e901dc8f82c8d751f690520c261b293b1480e7959218"
  },
  {
    "deviceId": "38f008a97b8fd5ff8d367c336fcb7120fdc499375fb44459980d60395516b955",
    "kind": "videoinput",
    "label": "camera2 1, facing front",
    "groupId": "3b073bb17b0c56c5f8e6f143d6eeebcbfac5ec2ebc8ff2bc852f66745a63c591"
  },
  {
    "deviceId": "bbf2c347dbfc70b9e37b16be622c4973a74269c7f53d4162adab0c09614514d1",
    "kind": "videoinput",
    "label": "camera2 0, facing back",
    "groupId": "5a8b08633d9b089d234fc7bb0d67fae394e90a4f7948128562251d17408d99d4"
  },
  {
    "deviceId": "default",
    "kind": "audiooutput",
    "label": "Default",
    "groupId": "default"
  }
]

我已经在其他三个android移动浏览器中进行了尝试,它也在这些设备中交换值。在PC中,它可以正常工作。为什么要在移动浏览器中交换这些值?

此外,我已经检查了此网页以进行验证-webrtc input-output devices,此处在音频输入设备列表中显示了免提电话,如下面的屏幕快照所示。

enter image description here

0 个答案:

没有答案