Fixes IE 10 support

This commit is contained in:
hristoterezov 2015-12-16 19:09:34 +11:00
parent 7e5599421f
commit ceb26cf74a
7 changed files with 596 additions and 904 deletions

View File

@ -12,6 +12,9 @@ var confOptions = {
openSctp: true
}
var isJoined = false;
/**
* Handles local tracks.
* @param tracks Array with JitsiTrack objects
@ -23,15 +26,15 @@ function onLocalTracks(tracks)
{
localTracks[i].addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
function (audioLevel) {
console.debug("Audio Level local: " + audioLevel);
console.log("Audio Level local: " + audioLevel);
});
localTracks[i].addEventListener(JitsiMeetJS.events.track.TRACK_MUTE_CHANGED,
function () {
console.debug("local track muted");
console.log("local track muted");
});
localTracks[i].addEventListener(JitsiMeetJS.events.track.TRACK_STOPPED,
function () {
console.debug("local track stoped");
console.log("local track stoped");
});
if(localTracks[i].getType() == "video") {
$("body").append("<video autoplay='1' id='localVideo" + i + "' />");
@ -40,6 +43,8 @@ function onLocalTracks(tracks)
$("body").append("<audio autoplay='1' id='localAudio" + i + "' />");
localTracks[i].attach($("#localAudio" + i ));
}
if(isJoined)
room.addTrack(localTracks[i]);
}
}
@ -56,21 +61,21 @@ function onRemoteTrack(track) {
var idx = remoteTracks[participant].push(track);
track.addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
function (audioLevel) {
console.debug("Audio Level remote: " + audioLevel);
console.log("Audio Level remote: " + audioLevel);
});
track.addEventListener(JitsiMeetJS.events.track.TRACK_MUTE_CHANGED,
function () {
console.debug("remote track muted");
console.log("remote track muted");
});
track.addEventListener(JitsiMeetJS.events.track.TRACK_STOPPED,
function () {
console.debug("remote track stoped");
console.log("remote track stoped");
});
var id = participant + track.getType() + idx;
if(track.getType() == "video") {
$("body").append("<video autoplay='1' id='" + participant + "video" + idx + "' />");
} else {
$("body").append("<audio autoplay='1' id='" + participant + "audio' />");
$("body").append("<audio autoplay='1' id='" + participant + "audio" + idx + "' />");
}
track.attach($("#" + id));
}
@ -80,6 +85,7 @@ function onRemoteTrack(track) {
*/
function onConferenceJoined () {
console.log("conference joined!");
isJoined = true;
for(var i = 0; i < localTracks.length; i++)
room.addTrack(localTracks[i]);
}
@ -99,16 +105,16 @@ function onConnectionSuccess(){
room = connection.initJitsiConference("conference2", confOptions);
room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
room.on(JitsiMeetJS.events.conference.TRACK_REMOVED, function (track) {
console.debug("track removed!!!" + track);
console.log("track removed!!!" + track);
});
room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
room.on(JitsiMeetJS.events.conference.USER_JOINED, function(id){ remoteTracks[id] = [];});
room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
room.on(JitsiMeetJS.events.conference.TRACK_MUTE_CHANGED, function (track) {
console.debug(track.getType() + " - " + track.isMuted());
console.log(track.getType() + " - " + track.isMuted());
});
room.on(JitsiMeetJS.events.conference.DISPLAY_NAME_CHANGED, function (userID, displayName) {
console.debug(userID + " - " + displayName);
console.log(userID + " - " + displayName);
});
room.on(JitsiMeetJS.events.conference.TRACK_AUDIO_LEVEL_CHANGED,
function(userID, audioLevel){
@ -181,9 +187,9 @@ JitsiMeetJS.init(initOptions).then(function(){
then(onLocalTracks).catch(function (error) {
console.log(error);
});
}).catch(function (error) {
console.log(error);
});
}).catch(function (error) {
console.log(error);
});
var connection = null;
var room = null;

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,6 @@ function JitsiLocalTrack(stream, videoType,
this.dontFireRemoveEvent = false;
this.resolution = resolution;
this.startMuted = false;
this.isLocal = true;
var self = this;
JitsiTrack.call(this, null, stream,
function () {

View File

@ -22,7 +22,6 @@ function JitsiRemoteTrack(RTC, data, sid, ssrc) {
this.videoType = data.videoType;
this.ssrc = ssrc;
this.muted = false;
this.isLocal = false;
if((this.type === JitsiTrack.AUDIO && data.audiomuted)
|| (this.type === JitsiTrack.VIDEO && data.videomuted)) {
this.muted = true;

View File

@ -1,6 +1,5 @@
/*! adapterjs - v0.12.0 - 2015-09-04 */
/*! adapterjs - v0.12.3 - 2015-11-16 */
var console = require("jitsi-meet-logger").getLogger(__filename);
// Adapter's interface.
var AdapterJS = AdapterJS || {};
@ -18,7 +17,7 @@ AdapterJS.options = AdapterJS.options || {};
// AdapterJS.options.hidePluginInstallPrompt = true;
// AdapterJS version
AdapterJS.VERSION = '0.12.0';
AdapterJS.VERSION = '0.12.3';
// This function will be called when the WebRTC API is ready to be used
// Whether it is the native implementation (Chrome, Firefox, Opera) or
@ -608,7 +607,7 @@ if (navigator.mozGetUserMedia) {
createIceServers = function (urls, username, password) {
var iceServers = [];
for (i = 0; i < urls.length; i++) {
for (var i = 0; i < urls.length; i++) {
var iceServer = createIceServer(urls[i], username, password);
if (iceServer !== null) {
iceServers.push(iceServer);
@ -698,7 +697,7 @@ if (navigator.mozGetUserMedia) {
'username' : username
};
} else {
for (i = 0; i < urls.length; i++) {
for (var i = 0; i < urls.length; i++) {
var iceServer = createIceServer(urls[i], username, password);
if (iceServer !== null) {
iceServers.push(iceServer);
@ -1000,12 +999,13 @@ if (navigator.mozGetUserMedia) {
return;
}
var streamId
var streamId;
if (stream === null) {
streamId = '';
}
else {
stream.enableSoundTracks(true); // TODO: remove on 0.12.0
} else {
if (typeof stream.enableSoundTracks !== 'undefined') {
stream.enableSoundTracks(true);
}
streamId = stream.id;
}
@ -1047,16 +1047,13 @@ if (navigator.mozGetUserMedia) {
var height = '';
var width = '';
if (element.getBoundingClientRect) {
var rectObject = element.getBoundingClientRect();
width = rectObject.width + 'px';
height = rectObject.height + 'px';
if (element.clientWidth || element.clientHeight) {
width = element.clientWidth;
height = element.clientHeight;
}
else if (element.width) {
else if (element.width || element.height) {
width = element.width;
height = element.height;
} else {
// TODO: What scenario could bring us here?
}
element.parentNode.insertBefore(frag, element);
@ -1075,19 +1072,7 @@ if (navigator.mozGetUserMedia) {
element.setStreamId(streamId);
}
var newElement = document.getElementById(elementId);
newElement.onplaying = (element.onplaying) ? element.onplaying : function (arg) {};
newElement.onplay = (element.onplay) ? element.onplay : function (arg) {};
newElement.onclick = (element.onclick) ? element.onclick : function (arg) {};
if (isIE) { // on IE the event needs to be plugged manually
newElement.attachEvent('onplaying', newElement.onplaying);
newElement.attachEvent('onplay', newElement.onplay);
newElement._TemOnClick = function (id) {
var arg = {
srcElement : document.getElementById(id)
};
newElement.onclick(arg);
};
}
AdapterJS.forwardEventHandlers(newElement, element, Object.getPrototypeOf(element));
return newElement;
};
@ -1110,6 +1095,32 @@ if (navigator.mozGetUserMedia) {
}
};
AdapterJS.forwardEventHandlers = function (destElem, srcElem, prototype) {
properties = Object.getOwnPropertyNames( prototype );
for(prop in properties) {
propName = properties[prop];
if (typeof(propName.slice) === 'function') {
if (propName.slice(0,2) == 'on' && srcElem[propName] != null) {
if (isIE) {
destElem.attachEvent(propName,srcElem[propName]);
} else {
destElem.addEventListener(propName.slice(2), srcElem[propName], false)
}
} else {
//TODO (http://jira.temasys.com.sg/browse/TWP-328) Forward non-event properties ?
}
}
}
var subPrototype = Object.getPrototypeOf(prototype)
if(subPrototype != null) {
AdapterJS.forwardEventHandlers(destElem, srcElem, subPrototype);
}
}
RTCIceCandidate = function (candidate) {
if (!candidate.sdpMid) {
candidate.sdpMid = '';

View File

@ -25,7 +25,7 @@ function TraceablePeerConnection(ice_config, constraints, session) {
var Interop = require('sdp-interop').Interop;
this.interop = new Interop();
var Simulcast = require('sdp-simulcast');
this.simulcast = new Simulcast({numOfLayers: 2, explodeRemoteSimulcast: false});
this.simulcast = new Simulcast({numOfLayers: 3, explodeRemoteSimulcast: false});
// override as desired
this.trace = function (what, info) {

View File

@ -19,7 +19,7 @@
"pako": "*",
"sdp-interop": "0.1.11",
"sdp-transform": "1.5.*",
"sdp-simulcast": "0.1.3",
"sdp-simulcast": "jitsi/sdp-simulcast",
"async": "0.9.0",
"retry": "0.6.1",
"jssha": "1.5.0",
@ -39,4 +39,4 @@
"lint"
],
"license": "Apache-2.0"
}
}