summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2021-08-30 11:56:33 +0200
committerGitHub <noreply@github.com>2021-08-30 11:56:33 +0200
commit501fb5294dfee1d8a923846c7d92cf074c8486e6 (patch)
treea6d76f1215ea8050f04e2d9972b78a7353bba9ef
parentb56a4b0631f14be425cbb2337ac1fb798ad88f72 (diff)
parent6642b2bc1d281e533e6c92b3c1e60939c40dccd1 (diff)
Merge pull request #6152 from nextcloud/bugfix/noid/log-device-selection-falling-back-and-also-try-by-label
Add some logging to the device selection
-rw-r--r--src/utils/webrtc/MediaDevicesManager.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/utils/webrtc/MediaDevicesManager.js b/src/utils/webrtc/MediaDevicesManager.js
index e94529753..e9d6b8a13 100644
--- a/src/utils/webrtc/MediaDevicesManager.js
+++ b/src/utils/webrtc/MediaDevicesManager.js
@@ -226,6 +226,22 @@ MediaDevicesManager.prototype = {
this._addDevice(addedDevice)
})
+ // Fallback in case we didn't find the previously picked device
+ if (this.attributes.audioInputId === undefined) {
+ if (BrowserStorage.getItem('audioInputId')) {
+ // Couldn't find device by id
+ console.debug('Could not find previous audio device, falling back to default/first device in the list', BrowserStorage.getItem('audioInputId'), this.attributes.devices)
+ }
+ this.attributes.audioInputId = this._fallbackAudioInputId
+ }
+ if (this.attributes.videoInputId === undefined) {
+ if (BrowserStorage.getItem('videoInputId')) {
+ // Couldn't find device by id, try the label
+ console.debug('Could not find previous video device, falling back to default/first device in the list', BrowserStorage.getItem('videoInputId'), this.attributes.devices)
+ }
+ this.attributes.videoInputId = this._fallbackVideoInputId
+ }
+
// Trigger change events after all the devices are processed to
// prevent change events for intermediate states.
if (previousAudioInputId !== this.attributes.audioInputId) {
@@ -325,9 +341,6 @@ MediaDevicesManager.prototype = {
if (!this._fallbackAudioInputId || addedDevice.deviceId === 'default') {
this._fallbackAudioInputId = addedDevice.deviceId
}
- if (this.attributes.audioInputId === undefined) {
- this.attributes.audioInputId = this._fallbackAudioInputId
- }
} else if (addedDevice.kind === 'videoinput') {
if (BrowserStorage.getItem('videoInputId') === addedDevice.deviceId) {
this.attributes.videoInputId = addedDevice.deviceId
@@ -335,9 +348,6 @@ MediaDevicesManager.prototype = {
if (!this._fallbackVideoInputId || addedDevice.deviceId === 'default') {
this._fallbackVideoInputId = addedDevice.deviceId
}
- if (this.attributes.videoInputId === undefined) {
- this.attributes.videoInputId = this._fallbackVideoInputId
- }
}
this.attributes.devices.push(addedDevice)