Skip to content

Commit

Permalink
Merge pull request #221 from nextcloud/issue-160-no-camera
Browse files Browse the repository at this point in the history
Use app with no-camera devices
  • Loading branch information
nickvergessen authored Jan 18, 2017
2 parents 34b2942 + 88fd82e commit 6dfd35c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
9 changes: 7 additions & 2 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,17 @@

uiChannel.trigger('document:click', event);
},
initAudioVideoSettings: function() {
initAudioVideoSettings: function(configuration) {
if (OCA.SpreedMe.app.audioDisabled) {
OCA.SpreedMe.app.disableAudio();
}

if (OCA.SpreedMe.app.videoDisabled) {
if (configuration.video !== false) {
if (OCA.SpreedMe.app.videoDisabled) {
OCA.SpreedMe.app.disableVideo();
}
} else {
OCA.SpreedMe.app.videoWasEnabledAtLeastOnce = false;
OCA.SpreedMe.app.disableVideo();
}
},
Expand Down
4 changes: 2 additions & 2 deletions js/simplewebrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5360,7 +5360,7 @@
self.emit('localStream', stream);
} else {
// Fallback for users without a camera
if (self.config.audioFallback && err.name === 'DevicesNotFoundError' && constraints.video !== false) {
if (self.config.audioFallback && (err.name === 'DevicesNotFoundError' || err.name === 'NotFoundError') && constraints.video !== false) {
constraints.video = false;
self.start(constraints, cb);
return;
Expand Down Expand Up @@ -14183,7 +14183,7 @@
if (err) {
self.emit('localMediaError', err);
} else {
self.emit('localMediaStarted');
self.emit('localMediaStarted', self.config.media);
attachMediaStream(stream, self.getLocalVideoContainer(), self.config.localVideo);
}
});
Expand Down
5 changes: 3 additions & 2 deletions js/webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ var spreedMappingTable = [];
}
},
autoAdjustMic: false,
audioFallback: true,
detectSpeakingEvents: true,
connection: OCA.SpreedMe.XhrConnection,
enableDataChannels: true,
Expand Down Expand Up @@ -267,8 +268,8 @@ var spreedMappingTable = [];
});
});

OCA.SpreedMe.webrtc.on('localMediaStarted', function () {
OCA.SpreedMe.app.initAudioVideoSettings();
OCA.SpreedMe.webrtc.on('localMediaStarted', function (configuration) {
OCA.SpreedMe.app.initAudioVideoSettings(configuration);
});

OCA.SpreedMe.webrtc.on('localMediaError', function(error) {
Expand Down

0 comments on commit 6dfd35c

Please sign in to comment.