diff --git a/app.js b/app.js index c2e5f8b41..360a8f91c 100644 --- a/app.js +++ b/app.js @@ -6,6 +6,7 @@ var activecall = null; var RTC = null; var nickname = null; var sharedKey = ''; +var recordingToken =''; var roomUrl = null; var ssrc2jid = {}; /** @@ -613,6 +614,7 @@ $(document).bind('joined.muc', function (event, jid, info) { if (Object.keys(connection.emuc.members).length < 1) { focus = new ColibriFocus(connection, config.hosts.bridge); + showRecordingButton(false); } if (focus && config.etherpad_base) { @@ -633,6 +635,7 @@ $(document).bind('joined.muc', function (event, jid, info) { $(document).bind('entered.muc', function (event, jid, info, pres) { console.log('entered', jid, info); + console.log('is focus?' + focus ? 'true' : 'false'); // Add Peer's container @@ -643,6 +646,7 @@ $(document).bind('entered.muc', function (event, jid, info, pres) { if (focus.confid === null) { console.log('make new conference with', jid); focus.makeConference(Object.keys(connection.emuc.members)); + showRecordingButton(true); } else { console.log('invite', jid, 'into conference'); focus.addNewParticipant(jid); @@ -688,17 +692,20 @@ $(document).bind('left.muc', function (event, jid) { && !sessionTerminated) { console.log('welcome to our new focus... myself'); focus = new ColibriFocus(connection, config.hosts.bridge); + if (Object.keys(connection.emuc.members).length > 0) { focus.makeConference(Object.keys(connection.emuc.members)); + showRecordingButton(true); } $(document).trigger('focusechanged.muc', [focus]); } else if (focus && Object.keys(connection.emuc.members).length === 0) { console.log('everyone left'); // FIXME: closing the connection is a hack to avoid some - // problemswith reinit + // problems with reinit disposeConference(); focus = new ColibriFocus(connection, config.hosts.bridge); + showRecordingButton(false); } if (connection.emuc.getPrezi(jid)) { $(document).trigger('presentationremoved.muc', @@ -867,6 +874,57 @@ function toggleAudio() { buttonClick("#mute", "icon-microphone icon-mic-disabled"); } +// Starts or stops the recording for the conference. +function toggleRecording() { + if (focus === null || focus.confid === null) { + console.log('non-focus, or conference not yet organized: not enabling recording'); + return; + } + + if (!recordingToken) + { + $.prompt('

Enter recording token

' + + '', + { + persistent: false, + buttons: { "Save": true, "Cancel": false}, + defaultButton: 1, + loaded: function (event) { + document.getElementById('recordingToken').focus(); + }, + submit: function (e, v, m, f) { + if (v) { + var token = document.getElementById('recordingToken'); + + if (token.value) { + setRecordingToken(Util.escapeHtml(token.value)); + toggleRecording(); + } + } + } + } + ); + + return; + } + + var oldState = focus.recordingEnabled; + buttonClick("#recordButton", "icon-recEnable icon-recDisable"); + focus.setRecording(!oldState, + recordingToken, + function (state) { + console.log("New recording state: ", state); + if (state == oldState) //failed to change, reset the token because it might have been wrong + { + buttonClick("#recordButton", "icon-recEnable icon-recDisable"); + setRecordingToken(null); + } + } + ); + + +} + /** * Returns an array of the video horizontal and vertical indents, * so that if fits its parent. @@ -1111,6 +1169,10 @@ function setSharedKey(sKey) { sharedKey = sKey; } +function setRecordingToken(token) { + recordingToken = token; +} + /** * Updates the room invite url. */ @@ -1171,6 +1233,20 @@ function setView(viewName) { // } } +function showRecordingButton(show) { + if (!config.enableRecording) { + return; + } + + if (show) { + $('#recording').css({display: "inline"}); + } + else { + $('#recording').css({display: "none"}); + } + +} + $(document).bind('fatalError.jingle', function (event, session, error) { diff --git a/config.js b/config.js index 22d93589a..966a1da9e 100644 --- a/config.js +++ b/config.js @@ -13,5 +13,6 @@ var config = { chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk', // Id of desktop streamer Chrome extension minChromeExtVersion: '0.1', // Required version of Chrome extension enableRtpStats: false, // Enables RTP stats processing - openSctp: true //Toggle to enable/disable SCTP channels -}; \ No newline at end of file + openSctp: true, //Toggle to enable/disable SCTP channels + enableRecording: false +}; diff --git a/css/font.css b/css/font.css index b0caacf70..43bc19b47 100755 --- a/css/font.css +++ b/css/font.css @@ -23,7 +23,18 @@ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } - +.icon-callRetro:before { + content: "\e611"; +} +.icon-callModern:before { + content: "\e612"; +} +.icon-recDisable:before { + content: "\e613"; +} +.icon-recEnable:before { + content: "\e614"; +} .icon-kick1:before { content: "\e60f"; } diff --git a/fonts/jitsi.eot b/fonts/jitsi.eot index 0679560af..41fe9eeea 100755 Binary files a/fonts/jitsi.eot and b/fonts/jitsi.eot differ diff --git a/fonts/jitsi.svg b/fonts/jitsi.svg index b2289b675..789f6cd31 100755 --- a/fonts/jitsi.svg +++ b/fonts/jitsi.svg @@ -15,13 +15,17 @@ - + - - + + + + + + \ No newline at end of file diff --git a/fonts/jitsi.ttf b/fonts/jitsi.ttf index dfe9bade0..654dddab5 100755 Binary files a/fonts/jitsi.ttf and b/fonts/jitsi.ttf differ diff --git a/fonts/jitsi.woff b/fonts/jitsi.woff index 23574d131..3aa49fdc4 100755 Binary files a/fonts/jitsi.woff and b/fonts/jitsi.woff differ diff --git a/index.html b/index.html index a99546eb9..cb519c250 100644 --- a/index.html +++ b/index.html @@ -66,6 +66,11 @@
+
diff --git a/libs/colibri/colibri.focus.js b/libs/colibri/colibri.focus.js index 8978b96d6..e0e6cf2c5 100644 --- a/libs/colibri/colibri.focus.js +++ b/libs/colibri/colibri.focus.js @@ -77,6 +77,8 @@ function ColibriFocus(connection, bridgejid) { // silly wait flag this.wait = true; + + this.recordingEnabled = false; } // creates a conferences with an initial set of peers @@ -164,6 +166,36 @@ ColibriFocus.prototype.makeConference = function (peers) { */ }; +// Sends a COLIBRI message which enables or disables (according to 'state') the +// recording on the bridge. +ColibriFocus.prototype.setRecording = function(state, token, callback) { + var self = this; + var elem = $iq({to: this.bridgejid, type: 'get'}); + elem.c('conference', { + xmlns: 'http://jitsi.org/protocol/colibri', + id: this.confid + }); + elem.c('recording', {state: state, token: token}); + elem.up(); + + this.connection.sendIQ(elem, + function (result) { + console.log('Set recording "', state, '". Result:', result); + var recordingElem = $(result).find('>conference>recording'); + var newState = recordingElem.attr('state'); + if (newState == null){ + newState = false; + } + + self.recordingEnabled = newState; + callback(newState); + }, + function (error) { + console.warn(error); + } + ); +}; + ColibriFocus.prototype._makeConference = function () { var self = this; var elem = $iq({to: this.bridgejid, type: 'get'}); @@ -1120,4 +1152,4 @@ ColibriFocus.prototype.sendTerminate = function (session, reason, text) { window.clearInterval(this.statsinterval); this.statsinterval = null; } -}; \ No newline at end of file +};