Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/webrtc-media-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -1717,12 +1717,13 @@ const getMobileDevices = async function (kind, deviceConstraints = null) {
if (stream.getVideoTracks().length > 0) {
deviceId = stream.getVideoTracks()[0].getSettings().deviceId;
}
stream.getTracks().forEach((track) => {
stream.getTracks().forEach((track) => {
track.stop();
});
}
} catch (error) {
logger.error(LOG_PREFIX, "Can't get device access with video constraints " + JSON.stringify(constraints.video) + ", error " + error);
throw error;
}
return deviceId;
}
Expand Down Expand Up @@ -1752,6 +1753,11 @@ const getMobileDevices = async function (kind, deviceConstraints = null) {
}
} catch (error) {
logger.error(LOG_PREFIX, "Can't get device access with constraints " + JSON.stringify(constraints) + ", error " + error);
throw error;
}

if (!list) {
throw new Error("No media devices found");
}

return list;
Expand Down Expand Up @@ -1894,4 +1900,4 @@ module.exports = {
getAudioSourceDevice: getAudioSourceDevice,
getCacheInstance: getCacheInstance,
getVideoElement: getVideoElement
};
};