Skip to content

Commit

Permalink
Fixes for IE MediaStreamTrack.getSources().
Browse files Browse the repository at this point in the history
  • Loading branch information
Leticia Choo committed Jun 15, 2017
1 parent 76d6533 commit f69a6b6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
4 changes: 2 additions & 2 deletions source/js/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ require.config({

paths: {
socketio: '//cdn.temasys.com.sg/libraries/socket.io-client/1.4.8/socket.io',
adapter: '//cdn.temasys.com.sg/adapterjs/0.14.1/adapter.screenshare',
skylink: '//cdn.temasys.com.sg/skylink/skylinkjs/0.6.18/skylink.debug',
adapter: '//cdn.temasys.com.sg/adapterjs/0.14.3/adapter.screenshare',
skylink: '//cdn.temasys.com.sg/skylink/skylinkjs/0.6.x/skylink.debug',
// facebook: '//connect.facebook.net/en_US/all',
// twitter: '//platform.twitter.com/widgets',
fastclick: '//cdnjs.cloudflare.com/ajax/libs/fastclick/0.6.11/fastclick.min',
Expand Down
37 changes: 32 additions & 5 deletions source/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,39 @@ define([
roomServer: Configs.Skylink.roomServer,
apiKey: useMCU ?
Configs.Skylink.apiMCUKey : Configs.Skylink.apiNoMCUKey,
defaultRoom: room
defaultRoom: room,
audioFallback: true
}, function() {
Skylink.joinRoom({
audio: { stereo: true, echoCancellation: true },
video: true
});
var fnOnItems = function (sources) {
var hasAudio = false;
var hasVideo = false;
var index = 0;

while (index < sources.length) {
if (sources[index].kind === 'audioinput') {
hasAudio = true;
} else if (sources[index].kind === 'videoinput') {
hasVideo = true;
}
index++;
}

Skylink.getUserMedia({
audio: hasAudio ? { stereo: true, echoCancellation: true } : false,
video: hasVideo
}, function () {
Skylink.joinRoom();
});
};

if (navigator.mediaDevices && typeof navigator.mediaDevices === 'object' &&
typeof navigator.mediaDevices.enumerateDevices === 'function') {
navigator.mediaDevices.enumerateDevices().then(fnOnItems);
} else if (window.MediaStreamTrack && typeof window.MediaStreamTrack.getSources === 'function') {
MediaStreamTrack.getSources(fnOnItems);
} else {
fnOnItems([{ kind: 'videoinput' }, { kind: 'audioinput' }]);
}
});
},
handleShowControls: function(e) {
Expand Down
4 changes: 2 additions & 2 deletions source/jsx/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ define([
var index = 0;

while (index < sources.length) {
if (sources[index].kind === 'audioinput') {
if (['audio', 'audioinput'].indexOf(sources[index].kind) > -1) {
hasAudio = true;
} else if (sources[index].kind === 'videoinput') {
} else if (['video', 'videoinput'].indexOf(sources[index].kind) > -1) {
hasVideo = true;
}
index++;
Expand Down

0 comments on commit f69a6b6

Please sign in to comment.