Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Extracts base class for ColibriFocus and JingleSession.
paweldomasa5951df0d95b
diff --git a/app.js b/app.jsindex 2c5a4fc1d8..193d44cb0a 100644--- a/app.js+++ b/app.js@@ -4,7 +4,6 @@ var connection = null;var focus = null;var activecall = null;var RTC = null;-var RTCPeerConnection = null;var nickname = null;var sharedKey = '';var roomUrl = null;@@ -23,7 +22,6 @@ function init() {window.location.href = 'chromeonly.html';return;}- RTCPeerconnection = TraceablePeerConnection;connection = new Strophe.Connection(document.getElementById('boshURL').value || config.bosh || '/http-bind');diff --git a/index.html b/index.htmlindex fc0733f3ba..f3de5fe2c3 100644--- a/index.html+++ b/index.html@@ -6,6 +6,7 @@<script src="libs/strophe/strophe.jingle.bundle.js?v=8"></script><script src="libs/strophe/strophe.jingle.js?v=1"></script><script src="libs/strophe/strophe.jingle.sdp.js?v=1"></script>+ <script src="libs/strophe/strophe.jingle.sessionbase.js?v=1"></script><script src="libs/strophe/strophe.jingle.session.js?v=1"></script><script src="libs/colibri/colibri.focus.js?v=8"></script><!-- colibri focus implementation --><script src="libs/colibri/colibri.session.js?v=1"></script>diff --git a/libs/colibri/colibri.focus.js b/libs/colibri/colibri.focus.jsindex 4ba0441c99..84e9473fe8 100644--- a/libs/colibri/colibri.focus.js+++ b/libs/colibri/colibri.focus.js@@ -34,17 +34,16 @@THE SOFTWARE.*//* jshint -W117 */++ColibriFocus.prototype = Object.create(SessionBase.prototype);function ColibriFocus(connection, bridgejid) {- this.connection = connection;++ SessionBase.call(this, connection);+this.bridgejid = bridgejid;this.peers = [];this.confid = null;- this.peerconnection- = new TraceablePeerConnection(- this.connection.jingle.ice_config,- this.connection.jingle.pc_constraints);-// media types of the conferencethis.media = ['audio', 'video'];@@ -623,9 +622,7 @@ ColibriFocus.prototype.sendSSRCUpdate = function (sdp, jid, isadd) {ColibriFocus.prototype.setRemoteDescription = function (session, elem, desctype) {var participant = this.peers.indexOf(session.peerjid);console.log('Colibri.setRemoteDescription from', session.peerjid, participant);- var self = this;var remoteSDP = new SDP('');- var tmp;var channel;remoteSDP.fromJingle(elem);@@ -800,19 +797,3 @@ ColibriFocus.prototype.terminate = function (session, reason) {delete this.remotessrc[session.peerjid];this.modifySources();};--ColibriFocus.prototype.modifySources = function () {- var self = this;- this.peerconnection.modifySources(function(){- $(document).trigger('setLocalDescription.jingle', [self.sid]);- });-};--ColibriFocus.prototype.hardMuteVideo = function (muted) {-- this.peerconnection.hardMuteVideo(muted);-- this.connection.jingle.localVideo.getVideoTracks().forEach(function (track) {- track.enabled = !muted;- });-};diff --git a/libs/strophe/strophe.jingle.session.js b/libs/strophe/strophe.jingle.session.jsindex 69f7b228b1..a6c75978f1 100644--- a/libs/strophe/strophe.jingle.session.js+++ b/libs/strophe/strophe.jingle.session.js@@ -1,27 +1,17 @@/* jshint -W117 */// Jingle stuff+JingleSession.prototype = Object.create(SessionBase.prototype);function JingleSession(me, sid, connection) {++ SessionBase.call(this, connection);+this.me = me;this.sid = sid;- this.connection = connection;this.initiator = null;this.responder = null;this.isInitiator = null;this.peerjid = null;this.state = null;- /**- * Peer connection instance.- * @type {TraceablePeerConnection}- */- this.peerconnection = null;- //console.log('create PeerConnection ' + JSON.stringify(this.ice_config));- try {- this.peerconnection = new RTCPeerconnection(this.ice_config, this.pc_constraints);- } catch (e) {- console.error('Failed to create PeerConnection, exception: ', e.message);- console.error(e);- }-this.localSDP = null;this.remoteSDP = null;this.localStreams = [];@@ -633,39 +623,6 @@ JingleSession.prototype.sendTerminate = function (reason, text) {}};--JingleSession.prototype.addSource = function (elem) {-- this.peerconnection.addSource(elem);-- this.modifySources();-};--JingleSession.prototype.removeSource = function (elem) {-- this.peerconnection.removeSource(elem);-- this.modifySources();-};--JingleSession.prototype.modifySources = function() {- var self = this;- this.peerconnection.modifySources(function(){- $(document).trigger('setLocalDescription.jingle', [self.sid]);- });-};--// SDP-based mute by going recvonly/sendrecv-// FIXME: should probably black out the screen as well-JingleSession.prototype.hardMuteVideo = function (muted) {-- this.peerconnection.hardMuteVideo(muted);-- this.connection.jingle.localVideo.getVideoTracks().forEach(function (track) {- track.enabled = !muted;- });-};-JingleSession.prototype.sendMute = function (muted, content) {var info = $iq({to: this.peerjid,type: 'set'})diff --git a/libs/strophe/strophe.jingle.sessionbase.js b/libs/strophe/strophe.jingle.sessionbase.jsnew file mode 100644index 0000000000..6388269e52--- /dev/null+++ b/libs/strophe/strophe.jingle.sessionbase.js@@ -0,0 +1,46 @@+/**+ * Base class for ColibriFocus and JingleSession.+ * @param connection Strophe connection object+ * @constructor+ */+function SessionBase(connection){++ this.connection = connection;+ this.peerconnection+ = new TraceablePeerConnection(+ connection.jingle.ice_config,+ connection.jingle.pc_constraints);+}+++SessionBase.prototype.modifySources = function() {+ var self = this;+ this.peerconnection.modifySources(function(){+ $(document).trigger('setLocalDescription.jingle', [self.sid]);+ });+};++SessionBase.prototype.addSource = function (elem) {++ this.peerconnection.addSource(elem);++ this.modifySources();+};++SessionBase.prototype.removeSource = function (elem) {++ this.peerconnection.removeSource(elem);++ this.modifySources();+};++// SDP-based mute by going recvonly/sendrecv+// FIXME: should probably black out the screen as well+SessionBase.prototype.hardMuteVideo = function (muted) {++ this.peerconnection.hardMuteVideo(muted);++ this.connection.jingle.localVideo.getVideoTracks().forEach(function (track) {+ track.enabled = !muted;+ });+};\ No newline at end of file