From c0dc84d8248a1a24ca5ae90ff882965cf2d698f6 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Tue, 1 Jul 2014 16:02:34 +0200 Subject: [PATCH] Adds a button for recording. --- app.js | 78 +++++++++++++++++++++++++++++++++- config.js | 5 ++- css/font.css | 13 +++++- fonts/jitsi.eot | Bin 5136 -> 7264 bytes fonts/jitsi.svg | 10 +++-- fonts/jitsi.ttf | Bin 4980 -> 7108 bytes fonts/jitsi.woff | Bin 3840 -> 5140 bytes index.html | 5 +++ libs/colibri/colibri.focus.js | 34 ++++++++++++++- 9 files changed, 137 insertions(+), 8 deletions(-) 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 0679560af40f425cce4a516651b04c734343c232..41fe9eeea3aed231312d4312f4b328100fa87392 100755 GIT binary patch delta 2450 zcmZ8iO^h5z6|Ps+Rn`A9)6+fwGxqe%_Uy*au=CgLU9TsbEM7~_0V09~vOQ$w7_AhH zjmRMgN6i70D`s;71c5|~#05kSzHkUqE+7;XKsll{9DD*HBm##p%d76)#Y(BWt6tZ8 z-+NW{y;t8|J-i@ZXc6*W^S+3+?|k9Wzwd9~DgBlZ@+*8_xOsc;ZsYU6d+GkWt<)=A zy+#P!C8YYF{abr4!Z+Xj6Cw3|)Qk7=hxUE?3zXkLxxat=1;ZulW~UzD?>Iwd4S!?(+gcH zU3U8P^0D8clT9`m&*>~y26UPzkWJ`773ZoQ@WrW3kZGsv#A5n?7ch;JIh)Ptc(RUW zEpP$N6vT-#1|mNhC%k2s8-+r{w=7@vWgAT3hOKKl*MJJc65KEi?lc<>$7$flZ8Xws z*mSZPVHtvg#?ityI8bZ=n$W6G4xg-QQUjpe&;fr+U4pK29AOihMulxVx>E`2p5;oa z7aLwU9Zh@c6MBuJj@xB<^`L@Ewk@cpiOiIyTsIULg6f9CLpQlQq1<76Kj^PFTkHJ* z`&JYCU*pm&>#?Q2q1(Cu#-%1LLsDRj0%aOw_|nq>{$fC-VWAplAkat_3u!^e1yZUB zZux#$2hLGK0L{?R0QGFg7EZlhvxBq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6Kl^wQhykJh-)EXL uSx-t*ayA3Q|Nl&L7@)eqN - + - - + + + + + + \ No newline at end of file diff --git a/fonts/jitsi.ttf b/fonts/jitsi.ttf index dfe9bade010eece4967a1d7796e494450a04a84a..654dddab54da071b0c56a7081dc3f98e818b12d9 100755 GIT binary patch delta 2477 zcmZ8iO^h5z6|Ps+_0zxe*FAqbGxqe%_IP7wJip!E^?KrDvunvg3Q@uV#a>uBPF6}x zjFLkl5_Jwpxo{!Q2_y(45)v1Xaxe!DAmsu=K>?H_TEihH5JC`fFtfbs-d(Ibb$8XP zs`tHD)!%#dujr#BB|r$V$yK~#0+)FRtSl^p|dm|#Gc?Jh&xAtDUO(JrL`Zd%~e`D{~&ELG(`U~oBpp(Jv zmtT1m14UW+;Jd%L0{%O&1^$PR!`})i4j&%SyKq2!@)@~L$g1zrUO1%l*@8|d9U80- z*#PwcHpfpd^r-aM$^H>|uS)xHUpaV6Wt98H^CpJO0I%UTev;Vt* zS)44`d_gDE5t_BY12oeR$BQu#`NcTl1E$m`?{?-U;#HBWhia{6{an?X_?$z zX*ONAi65`oOtbEao6QK@6ch}O7LLh*q5v4es69M&18iF>*!~)~X4?;J^*!Y%0gOvS+NPwy7zN4<#_**l9UNjnrD@|b&Oo4% zEEdv&!VOYt2yXj+MFHoiA%I~jG{AL^>j<~es5`;wcDv$KN}hDf4(CqUm0k%4+U?VU zQ*SifY$e$z`%l zu97FoGvupem)syE!C!tBG&f7gtBau7S%NN-F(_$rbT#uzNTeR`2Hkn3H=hRclTYoW zm*`%urYD2nmu|_rWR+Zb(t)>@pLzANZI|mFG~B%BF8>bJ^7Hjv_Aj8o`ue_BFI*@b z+ry8Kd&^z;#H!T2<=Y;T14-b)>t4NLZC$ytd~-cre?Bw*c>RkVLO3xG@6idK$XW6x z`2qPE`2@3hNQK0N@T;{BtHqNAJOUk-R2Ouhb1qrXXdtT|9SE(-d}^LZ%py^h6EP8U zF%prC!XeB>oQ82P4&yKxBqA2Etct2XmPw9<4)~BI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2_0^;sV$4=x@mJ1iKW%H= zzJthhIq z%GPh(Vy|m*c_QVun&~^=D4a9Lg1HvVvtT}BX*QKjW>X^H*k?N;rFQ4*k8o{pd%p6P4UJY|IyxWLwM?lyq;0a?qcUV!PX0LsF zsPntg3`er{0&Y>ZxA4nDyny5(yoZE8*>I}-Q_oTRfVz)uMR@l2C*C zdeo3IOF;F>`aW>u41}{dc@poFKWY2wPujuF<8O+_VPLsQa8(!>nJkt90|P**fZzT# zzW-!=-`paWkb@{5WJunCn? zS6vS`ii~{N1=Mx5oYGF|U2**sN3sUkA?S)m1Xa^iO;uGW@Iwx0A?R9w?oYRv<7)R| zfvSa?E?XWP&3!;z(Bg7zUxarjghbpS@(nQrz*1p#>>LlRpJ2% z9S8;VkVWKS?IiFJ=?YZZ5$&2jQp>4Y_!2Qow(eWCYCxl#~@5Mi09&0WtO#=yWGc5i)%g@3TV z5d#B{4^T-02y-a?IhLH8SO64T1LT9meWXIqq^BnqgT#IS`5aIzkdd00!oa`_f9mQ(=6Vu1V*5LPwzWH^?aSOGMUcLPv>4U9zt81fQx zQ-NYT7#JAULHK00%%g(*;u4_qA545kR^*2VMNd}ZKf0@}d9aDMjjA_V>aKGU4ZdP0(t ivl$rv|7V)Rzz9}^AVeo82!#N>6~MqCy7`ol7b5_G^;t6j 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 +};