mardi 4 février 2020

navigator.mediaDevices.ondevicechange not working while using audio jack

I'm trying to change the device change events using MediaDevice API as below

_trackDeviceChange: function () {
        var e = this
        navigator.mediaDevices.ondevicechange = function () {
          navigator.mediaDevices.enumerateDevices().then(function (n) {
            e.get('allVideoSourceDevices').clear(),
            e.get('allAudioSourceDevices').clear(),
            e.get('allVideoSourceDevices').pushObjects(t.default.filter(n, [
              'kind',
              'videoinput'
            ])), e.get('allAudioSourceDevices').pushObjects(t.default.filter(n, [
              'kind',
              'audioinput'
            ])), e.get('videoSourceDevice') && !t.default.find(n, {
              deviceId: e.get('videoSourceDevice.deviceId'),
              kind: 'videoinput',
              label: e.get('videoSourceDevice.label')
            }) ? e.set('deviceNotFound', 'camera')  : e.get('audioSourceDevice') && !t.default.find(n, {
              deviceId: e.get('audioSourceDevice.deviceId'),
              kind: 'audioinput',
              label: e.get('audioSourceDevice.label')
            }) && e.set('deviceNotFound', 'microphone')
          })
        }
      }

It is working only for USB devices not working for 3.5m jacks




Aucun commentaire:

Enregistrer un commentaire