From: Jaon EarlWolf Date: Tue, 8 Dec 2015 20:20:25 +0000 (-0300) Subject: FS-8603 [verto_communicator] - Added Device validation X-Git-Tag: v1.6.6~1^2~58^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22f766c28f12f1a003a5cd5167e8f072c279aa49;p=thirdparty%2Ffreeswitch.git FS-8603 [verto_communicator] - Added Device validation --- diff --git a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js index 3b2c01758a..42979e1d92 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js @@ -294,6 +294,28 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora } console.debug('Devices were refreshed, checking that we have cameras.'); + // Verify if selected devices are valid + var videoFlag = data.videoDevices.some(function(device) { + return device.id == storage.data.selectedVideo; + }); + + var shareFlag = data.shareDevices.some(function(device) { + return device.id == storage.data.selectedShare; + }); + + var audioFlag = data.audioDevices.some(function(device) { + return device.id == storage.data.selectedAudio; + }); + + var speakerFlag = data.speakerDevices.some(function(device) { + return device.id == storage.data.selectedSpeaker; + }); + + if (!videoFlag) storage.data.selectedVideo = data.videoDevices[0].id; + if (!shareFlag) storage.data.selectedShare = data.shareDevices[0].id; + if (!audioFlag) storage.data.selectedAudio = data.audioDevices[0].id; + if (!speakerFlag) storage.data.selectedSpeaker = data.speakerDevices[0].id; + // This means that we cannot use video! if (data.videoDevices.length === 0) { console.log('No camera, disabling video.');