Always try to use microphone if camera failed

When getting the local media it is first tried to get both microphone
and camera and, if that fails, then it is tried to get only the
microphone.

However, this was done only when certain errors happened while trying to
get both the microphone and the camera. Now, no matter the error, it is
tried too to get only the microphone; if the media is still unavailable
it will fail again, but this should help with some further scenarios not
covered yet in the previously handled errors in which camera is not
available but microphone is.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2020-06-08 11:05:32 +02:00
Родитель 7b3b93a5da
Коммит 4e9bb46e42
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -134,7 +134,7 @@ LocalMedia.prototype.start = function(mediaConstraints, cb) {
}).catch(function(err) {
// Fallback for users without a camera or with a camera that can not be
// accessed.
if (self.config.audioFallback && (err.name === 'NotFoundError' || err.name === 'NotReadableError') && constraints.video !== false) {
if (self.config.audioFallback && constraints.video !== false) {
constraints.video = false
self.start(constraints, cb)
return