瀏覽代碼

Updates use of recording states, add some information texts and notifications.

master
damencho 10 年之前
父節點
當前提交
4092d67853
共有 8 個檔案被更改,包括 22776 行新增22614 行删除
  1. 5
    0
      css/videolayout_default.css
  2. 1
    1
      index.html
  3. 6
    0
      lang/main.json
  4. 22692
    22594
      libs/app.bundle.js
  5. 35
    4
      modules/UI/toolbars/Toolbar.js
  6. 9
    1
      modules/UI/util/MessageHandler.js
  7. 26
    12
      modules/xmpp/recording.js
  8. 2
    2
      modules/xmpp/xmpp.js

+ 5
- 0
css/videolayout_default.css 查看文件

@@ -446,6 +446,11 @@
446 446
     background-position: center;
447 447
 }
448 448
 
449
+.videoMessageFilter {
450
+    -webkit-filter: grayscale(.5) opacity(0.8);
451
+    filter: grayscale(.5) opacity(0.8);
452
+}
453
+
449 454
 .videoProblemFilter {
450 455
     -webkit-filter: blur(10px) grayscale(.5) opacity(0.8);
451 456
     filter: blur(10px) grayscale(.5) opacity(0.8);

+ 1
- 1
index.html 查看文件

@@ -22,7 +22,7 @@
22 22
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
23 23
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
24 24
     <script src="interface_config.js?v=5"></script>
25
-    <script src="libs/app.bundle.js?v=119"></script>
25
+    <script src="libs/app.bundle.js?v=120"></script>
26 26
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
27 27
     <link rel="stylesheet" href="css/font.css?v=7"/>
28 28
     <link rel="stylesheet" href="css/toastr.css?v=1">

+ 6
- 0
lang/main.json 查看文件

@@ -240,5 +240,11 @@
240 240
         "FETCH_SESSION_ID": "Obtaining session-id...",
241 241
         "GOT_SESSION_ID": "Obtaining session-id... Done",
242 242
         "GET_SESSION_ID_ERROR": "Get session-id error: "
243
+    },
244
+    "recording":
245
+    {
246
+        "toaster": "Currently recording!",
247
+        "pending": "Your recording will start as soon as another participant joins",
248
+        "on": "Recording has been started"
243 249
     }
244 250
 }

+ 22692
- 22594
libs/app.bundle.js
文件差異過大導致無法顯示
查看文件


+ 35
- 4
modules/UI/toolbars/Toolbar.js 查看文件

@@ -13,6 +13,7 @@ var AuthenticationEvents
13 13
 var roomUrl = null;
14 14
 var sharedKey = '';
15 15
 var UI = null;
16
+var recordingToaster = null;
16 17
 
17 18
 var buttonHandlers = {
18 19
     "toolbar_button_mute": function () {
@@ -147,7 +148,7 @@ function toggleRecording() {
147 148
             function () { },
148 149
             ':input:first'
149 150
         );
150
-    }, Toolbar.setRecordingButtonState, Toolbar.setRecordingButtonState);
151
+    }, Toolbar.setRecordingButtonState);
151 152
 }
152 153
 
153 154
 /**
@@ -548,14 +549,44 @@ var Toolbar = (function (my) {
548 549
     };
549 550
 
550 551
     // Sets the state of the recording button
551
-    my.setRecordingButtonState = function (isRecording) {
552
+    my.setRecordingButtonState = function (recordingState) {
552 553
         var selector = $('#recordButton');
553
-        if (isRecording) {
554
+
555
+        if (recordingState === 'on') {
554 556
             selector.removeClass("icon-recEnable");
555 557
             selector.addClass("icon-recEnable active");
556
-        } else {
558
+
559
+            $("#largeVideo").toggleClass("videoMessageFilter", true);
560
+            var recordOnKey = "recording.on";
561
+            $('#videoConnectionMessage').attr("data-i18n", recordOnKey);
562
+            $('#videoConnectionMessage').text(APP.translation.translateString(recordOnKey));
563
+
564
+            setTimeout(function(){
565
+                $("#largeVideo").toggleClass("videoMessageFilter", false);
566
+                $('#videoConnectionMessage').css({display: "none"});
567
+            }, 1500);
568
+
569
+            recordingToaster = messageHandler.notify(null, "recording.toaster", null,
570
+                null, null, {timeOut: 0, closeButton: null});
571
+        } else if (recordingState === 'off') {
557 572
             selector.removeClass("icon-recEnable active");
558 573
             selector.addClass("icon-recEnable");
574
+
575
+            $("#largeVideo").toggleClass("videoMessageFilter", false);
576
+            $('#videoConnectionMessage').css({display: "none"});
577
+
578
+            if (recordingToaster)
579
+                messageHandler.remove(recordingToaster);
580
+
581
+        } else if (recordingState === 'pending') {
582
+            selector.removeClass("icon-recEnable active");
583
+            selector.addClass("icon-recEnable");
584
+
585
+            $("#largeVideo").toggleClass("videoMessageFilter", true);
586
+            var recordPendingKey = "recording.pending";
587
+            $('#videoConnectionMessage').attr("data-i18n", recordPendingKey);
588
+            $('#videoConnectionMessage').text(APP.translation.translateString(recordPendingKey));
589
+            $('#videoConnectionMessage').css({display: "block"});
559 590
         }
560 591
     };
561 592
 

+ 9
- 1
modules/UI/util/MessageHandler.js 查看文件

@@ -182,7 +182,7 @@ var messageHandler = (function(my) {
182 182
                 "'>" + APP.translation.translateString(displayNameKey);
183 183
         }
184 184
         displayNameSpan += "</span>";
185
-        toastr.info(
185
+        return toastr.info(
186 186
             displayNameSpan + '<br>' +
187 187
             '<span class=' + cls + ' data-i18n="' + messageKey + '"' +
188 188
                 (messageArguments?
@@ -193,6 +193,14 @@ var messageHandler = (function(my) {
193 193
             '</span>', null, options);
194 194
     };
195 195
 
196
+    /**
197
+     * Removes the toaster.
198
+     * @param toasterElement
199
+     */
200
+    my.remove = function(toasterElement) {
201
+        toasterElement.remove();
202
+    };
203
+
196 204
     return my;
197 205
 }(messageHandler || {}));
198 206
 

+ 26
- 12
modules/xmpp/recording.js 查看文件

@@ -19,6 +19,12 @@ var useJirecon = (typeof config.hosts.jirecon != "undefined");
19 19
  */
20 20
 var jireconRid = null;
21 21
 
22
+/**
23
+ * The callback to update the recording button. Currently used from colibri
24
+ * after receiving a pending status.
25
+ */
26
+var recordingStateChangeCallback = null;
27
+
22 28
 function setRecordingToken(token) {
23 29
     recordingToken = token;
24 30
 }
@@ -30,9 +36,9 @@ function setRecordingJirecon(state, token, callback, connection) {
30 36
 
31 37
     var iq = $iq({to: config.hosts.jirecon, type: 'set'})
32 38
         .c('recording', {xmlns: 'http://jitsi.org/protocol/jirecon',
33
-            action: state ? 'start' : 'stop',
39
+            action: (state === 'on') ? 'start' : 'stop',
34 40
             mucjid: connection.emuc.roomjid});
35
-    if (!state){
41
+    if (state === 'off'){
36 42
         iq.attrs({rid: jireconRid});
37 43
     }
38 44
 
@@ -44,10 +50,10 @@ function setRecordingJirecon(state, token, callback, connection) {
44 50
             // TODO wait for an IQ with the real status, since this is
45 51
             // provisional?
46 52
             jireconRid = $(result).find('recording').attr('rid');
47
-            console.log('Recording ' + (state ? 'started' : 'stopped') +
53
+            console.log('Recording ' + ((state === 'on') ? 'started' : 'stopped') +
48 54
                 '(jirecon)' + result);
49 55
             recordingEnabled = state;
50
-            if (!state){
56
+            if (state === 'off'){
51 57
                 jireconRid = null;
52 58
             }
53 59
 
@@ -73,10 +79,19 @@ function setRecordingColibri(state, token, callback, connection) {
73 79
         function (result) {
74 80
             console.log('Set recording "', state, '". Result:', result);
75 81
             var recordingElem = $(result).find('>conference>recording');
76
-            var newState = ('true' === recordingElem.attr('state'));
82
+            var newState = recordingElem.attr('state');
77 83
 
78 84
             recordingEnabled = newState;
79 85
             callback(newState);
86
+
87
+            if (newState === 'pending' && recordingStateChangeCallback == null) {
88
+                recordingStateChangeCallback = callback;
89
+                connection.addHandler(function(iq){
90
+                    var state = $(iq).find('recording').attr('state');
91
+                    if (state)
92
+                        recordingStateChangeCallback(state);
93
+                }, 'http://jitsi.org/protocol/colibri', 'iq', null, null, null);
94
+            }
80 95
         },
81 96
         function (error) {
82 97
             console.warn(error);
@@ -94,8 +109,7 @@ function setRecording(state, token, callback, connection) {
94 109
 }
95 110
 
96 111
 var Recording = {
97
-    toggleRecording: function (tokenEmptyCallback,
98
-                               startingCallback, startedCallback, connection) {
112
+    toggleRecording: function (tokenEmptyCallback, recordingStateChangeCallback, connection) {
99 113
         if (!Moderator.isModerator()) {
100 114
             console.log(
101 115
                     'non-focus, or conference not yet organized:' +
@@ -108,16 +122,16 @@ var Recording = {
108 122
         if (!recordingToken && !useJirecon) {
109 123
             tokenEmptyCallback(function (value) {
110 124
                 setRecordingToken(value);
111
-                self.toggleRecording(tokenEmptyCallback,
112
-                    startingCallback, startedCallback, connection);
125
+                self.toggleRecording(tokenEmptyCallback, recordingStateChangeCallback, connection);
113 126
             });
114 127
 
115 128
             return;
116 129
         }
117 130
 
118 131
         var oldState = recordingEnabled;
119
-        startingCallback(!oldState);
120
-        setRecording(!oldState,
132
+        var newState = (oldState === 'off' || !oldState) ? 'on' : 'off';
133
+
134
+        setRecording(newState,
121 135
             recordingToken,
122 136
             function (state) {
123 137
                 console.log("New recording state: ", state);
@@ -143,7 +157,7 @@ var Recording = {
143 157
                     // have been wrong
144 158
                     setRecordingToken(null);
145 159
                 }
146
-                startedCallback(state);
160
+                recordingStateChangeCallback(state);
147 161
 
148 162
             },
149 163
             connection

+ 2
- 2
modules/xmpp/xmpp.js 查看文件

@@ -434,9 +434,9 @@ var XMPP = {
434 434
         return true;
435 435
     },
436 436
     toggleRecording: function (tokenEmptyCallback,
437
-                               startingCallback, startedCallback) {
437
+                               recordingStateChangeCallback) {
438 438
         Recording.toggleRecording(tokenEmptyCallback,
439
-            startingCallback, startedCallback, connection);
439
+            recordingStateChangeCallback, connection);
440 440
     },
441 441
     addToPresence: function (name, value, dontSend) {
442 442
         switch (name) {

Loading…
取消
儲存