Skip to content

Commit

Permalink
Merge pull request #1559 from timsu/190323-fix-remove-video
Browse files Browse the repository at this point in the history
Don't call getUserMedia when audio and video are false
  • Loading branch information
lminiero authored Apr 1, 2019
2 parents 9318620 + 0015c97 commit c7b6661
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions html/janus.js
Original file line number Diff line number Diff line change
Expand Up @@ -2295,14 +2295,18 @@ function Janus(gatewayCallbacks) {
video: (videoExist && !media.keepVideo) ? videoSupport : false
};
Janus.debug("getUserMedia constraints", gumConstraints);
navigator.mediaDevices.getUserMedia(gumConstraints)
.then(function(stream) {
pluginHandle.consentDialog(false);
streamsDone(handleId, jsep, media, callbacks, stream);
}).catch(function(error) {
pluginHandle.consentDialog(false);
callbacks.error({code: error.code, name: error.name, message: error.message});
});
if (!gumConstraints.audio && !gumConstraints.video) {
streamsDone(handleId, jsep, media, callbacks, stream);
} else {
navigator.mediaDevices.getUserMedia(gumConstraints)
.then(function(stream) {
pluginHandle.consentDialog(false);
streamsDone(handleId, jsep, media, callbacks, stream);
}).catch(function(error) {
pluginHandle.consentDialog(false);
callbacks.error({code: error.code, name: error.name, message: error.message});
});
}
})
.catch(function(error) {
pluginHandle.consentDialog(false);
Expand Down

0 comments on commit c7b6661

Please sign in to comment.