瀏覽代碼

Implements start muted feature.

j8
hristoterezov 10 年之前
父節點
當前提交
099e3340bc

+ 0
- 2
config.js 查看文件

32
     enableWelcomePage: true,
32
     enableWelcomePage: true,
33
     enableSimulcast: false, // blocks FF support
33
     enableSimulcast: false, // blocks FF support
34
     logStats: false, // Enable logging of PeerConnection stats via the focus
34
     logStats: false, // Enable logging of PeerConnection stats via the focus
35
-    startVideoMuted: false,
36
-    startAudioMuted: false,
37
     /*noticeMessage: 'Service update is scheduled for 16th March 2015. ' +
35
     /*noticeMessage: 'Service update is scheduled for 16th March 2015. ' +
38
     'During that time service will not be available. ' +
36
     'During that time service will not be available. ' +
39
     'Apologise for inconvenience.'*/
37
     'Apologise for inconvenience.'*/

+ 18
- 0
css/settingsmenu.css 查看文件

47
 #languages_selectbox{
47
 #languages_selectbox{
48
     height: 40px;
48
     height: 40px;
49
 }
49
 }
50
+
51
+
52
+#startMutedOptions {
53
+    padding-left: 10%;
54
+    text-indent: -10%;
55
+}
56
+
57
+#startAudioMuted {
58
+    width: 13px !important;
59
+}
60
+
61
+#startVideoMuted {
62
+    width: 13px !important;
63
+}
64
+
65
+.startMutedLabel {
66
+    float: left;
67
+}

+ 12
- 2
index.html 查看文件

10
     <meta itemprop="description" content="Join a WebRTC video conference powered by the Jitsi Videobridge"/>
10
     <meta itemprop="description" content="Join a WebRTC video conference powered by the Jitsi Videobridge"/>
11
     <meta itemprop="image" content="/images/jitsilogo.png"/>
11
     <meta itemprop="image" content="/images/jitsilogo.png"/>
12
     <script src="libs/jquery-2.1.1.min.js"></script>
12
     <script src="libs/jquery-2.1.1.min.js"></script>
13
-    <script src="config.js?v=7"></script><!-- adapt to your needs, i.e. set hosts and bosh path -->
13
+    <script src="config.js?v=8"></script><!-- adapt to your needs, i.e. set hosts and bosh path -->
14
     <script src="libs/strophe/strophe.min.js?v=1"></script>
14
     <script src="libs/strophe/strophe.min.js?v=1"></script>
15
     <script src="libs/strophe/strophe.disco.min.js?v=1"></script>
15
     <script src="libs/strophe/strophe.disco.min.js?v=1"></script>
16
     <script src="libs/strophe/strophe.caps.jsonly.min.js?v=1"></script>
16
     <script src="libs/strophe/strophe.caps.jsonly.min.js?v=1"></script>
19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21
     <script src="interface_config.js?v=5"></script>
21
     <script src="interface_config.js?v=5"></script>
22
-    <script src="libs/app.bundle.js?v=66"></script>
22
+    <script src="libs/app.bundle.js?v=67"></script>
23
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
23
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
24
     <link rel="stylesheet" href="css/font.css?v=7"/>
24
     <link rel="stylesheet" href="css/font.css?v=7"/>
25
     <link rel="stylesheet" href="css/toastr.css?v=1">
25
     <link rel="stylesheet" href="css/toastr.css?v=1">
299
             <div class="arrow-up"></div>
299
             <div class="arrow-up"></div>
300
             <input type="text" id="setDisplayName" data-i18n="[placeholder]settings.name" placeholder="Name">
300
             <input type="text" id="setDisplayName" data-i18n="[placeholder]settings.name" placeholder="Name">
301
             <input type="text" id="setEmail" placeholder="E-Mail">
301
             <input type="text" id="setEmail" placeholder="E-Mail">
302
+            <div id = "startMutedOptions">
303
+                <label class = "startMutedLabel">
304
+                    <input type="checkbox" id="startAudioMuted">
305
+                    <span  data-i18n="settings.startAudioMuted"></span>
306
+                </label>
307
+                <label class = "startMutedLabel">
308
+                    <input type="checkbox" id="startVideoMuted">
309
+                    <span data-i18n="settings.startVideoMuted"></span>
310
+                </label>
311
+            </div>
302
             <button id="updateSettings" data-i18n="settings.update"></button>
312
             <button id="updateSettings" data-i18n="settings.update"></button>
303
         </div>
313
         </div>
304
         <a id="downloadlog" data-container="body" data-toggle="popover" data-placement="right" data-i18n="[data-content]downloadlogs" ><i class="fa fa-cloud-download"></i></a>
314
         <a id="downloadlog" data-container="body" data-toggle="popover" data-placement="right" data-i18n="[data-content]downloadlogs" ><i class="fa fa-cloud-download"></i></a>

+ 3
- 1
lang/main.json 查看文件

81
     {
81
     {
82
         "title": "SETTINGS",
82
         "title": "SETTINGS",
83
         "update": "Update",
83
         "update": "Update",
84
-        "name": "Name"
84
+        "name": "Name",
85
+        "startAudioMuted": "everyone join audio muted",
86
+        "startVideoMuted": "everyone join video muted"
85
     },
87
     },
86
     "videothumbnail":
88
     "videothumbnail":
87
     {
89
     {

+ 11
- 13
modules/RTC/RTC.js 查看文件

17
 function getMediaStreamUsage()
17
 function getMediaStreamUsage()
18
 {
18
 {
19
     var result = {
19
     var result = {
20
-        audio: 1,
21
-        video: 1
20
+        audio: true,
21
+        video: true
22
     };
22
     };
23
-    if( config.startAudioMuted === true)
24
-        result.audio = 0;
25
-    if( config.startVideoMuted === true)
26
-        result.video = 0;
27
 
23
 
28
     /** There are some issues with the desktop sharing
24
     /** There are some issues with the desktop sharing
29
      * when this property is enabled.
25
      * when this property is enabled.
26
+     * WARNING: We must change the implementation to start video/audio if we
27
+     * receive from the focus that the peer is not muted.
30
 
28
 
31
-     if(result.audio > 0 && result.video > 0)
32
-        return result;
33
      var isSecureConnection = window.location.protocol == "https:";
29
      var isSecureConnection = window.location.protocol == "https:";
34
 
30
 
35
     if(config.disableEarlyMediaPermissionRequests || !isSecureConnection)
31
     if(config.disableEarlyMediaPermissionRequests || !isSecureConnection)
36
     {
32
     {
37
-        if(result.audio === 0)
38
-            result.audio = -1;
39
-        if(result.video === 0)
40
-            result.video = -1;
41
-    }**/
33
+        result = {
34
+            audio: false,
35
+            video: false
36
+        };
37
+
38
+    }
39
+    **/
42
 
40
 
43
     return result;
41
     return result;
44
 }
42
 }

+ 9
- 6
modules/RTC/RTCUtils.js 查看文件

300
  * We ask for audio and video combined stream in order to get permissions and
300
  * We ask for audio and video combined stream in order to get permissions and
301
  * not to ask twice.
301
  * not to ask twice.
302
  */
302
  */
303
-RTCUtils.prototype.obtainAudioAndVideoPermissions = function(devices, callback, usageOptions) {
303
+RTCUtils.prototype.obtainAudioAndVideoPermissions =
304
+    function(devices, callback, usageOptions)
305
+{
304
     var self = this;
306
     var self = this;
305
     // Get AV
307
     // Get AV
306
 
308
 
321
         for(var i = 0; i < devices.length; i++)
323
         for(var i = 0; i < devices.length; i++)
322
         {
324
         {
323
             var device = devices[i];
325
             var device = devices[i];
324
-            if(usageOptions[device] !== -1)
326
+            if(usageOptions[device] === true)
325
                 newDevices.push(device);
327
                 newDevices.push(device);
326
         }
328
         }
327
     else
329
     else
455
         videoStream = stream.videoStream;
457
         videoStream = stream.videoStream;
456
     }
458
     }
457
 
459
 
458
-    var audioMuted = (usageOptions && usageOptions.audio != 1),
459
-        videoMuted = (usageOptions && usageOptions.video != 1);
460
+    var audioMuted = (usageOptions && usageOptions.audio === false),
461
+        videoMuted = (usageOptions && usageOptions.video === false);
462
+
463
+    var audioGUM = (!usageOptions || usageOptions.audio !== false),
464
+        videoGUM = (!usageOptions || usageOptions.video !== false);
460
 
465
 
461
-    var audioGUM = (!usageOptions || usageOptions.audio != -1),
462
-        videoGUM = (!usageOptions || usageOptions.video != -1);
463
 
466
 
464
     this.service.createLocalStream(audioStream, "audio", null, null,
467
     this.service.createLocalStream(audioStream, "audio", null, null,
465
         audioMuted, audioGUM);
468
         audioMuted, audioGUM);

+ 12
- 6
modules/UI/UI.js 查看文件

34
 
34
 
35
 function notifyForInitialMute()
35
 function notifyForInitialMute()
36
 {
36
 {
37
-    if(config.startAudioMuted || config.startVideoMuted)
38
-    {
39
-        messageHandler.notify(null, "notify.mutedTitle", "connected", "notify.muted", null, {timeOut: 120000});
40
-    }
37
+    messageHandler.notify(null, "notify.mutedTitle", "connected",
38
+        "notify.muted", null, {timeOut: 120000});
41
 }
39
 }
42
 
40
 
43
 function setupPrezi()
41
 function setupPrezi()
254
 
252
 
255
     APP.members.addListener(MemberEvents.DTMF_SUPPORT_CHANGED,
253
     APP.members.addListener(MemberEvents.DTMF_SUPPORT_CHANGED,
256
                             onDtmfSupportChanged);
254
                             onDtmfSupportChanged);
255
+    APP.xmpp.addListener(XMPPEvents.START_MUTED, function (audio, video) {
256
+        SettingsMenu.setStartMuted(audio, video);
257
+    });
257
 }
258
 }
258
 
259
 
259
 
260
 
408
 
409
 
409
     SettingsMenu.init();
410
     SettingsMenu.init();
410
 
411
 
411
-    notifyForInitialMute();
412
-
413
 };
412
 };
414
 
413
 
415
 function chatAddError(errorMessage, originalText)
414
 function chatAddError(errorMessage, originalText)
485
     console.info("My role changed, new role: " + info.role);
484
     console.info("My role changed, new role: " + info.role);
486
     onModeratorStatusChanged(isModerator);
485
     onModeratorStatusChanged(isModerator);
487
     VideoLayout.showModeratorIndicator();
486
     VideoLayout.showModeratorIndicator();
487
+    SettingsMenu.onRoleChanged();
488
 
488
 
489
     if (isModerator) {
489
     if (isModerator) {
490
         Authentication.closeAuthenticationWindow();
490
         Authentication.closeAuthenticationWindow();
729
     return roomName;
729
     return roomName;
730
 };
730
 };
731
 
731
 
732
+UI.setInitialMuteFromFocus = function (muteAudio, muteVideo) {
733
+    if(muteAudio || muteVideo) notifyForInitialMute();
734
+    if(muteAudio) UI.setAudioMuted(true);
735
+    if(muteVideo) UI.setVideoMute(true);
736
+}
737
+
732
 /**
738
 /**
733
  * Mutes/unmutes the local video.
739
  * Mutes/unmutes the local video.
734
  */
740
  */

+ 30
- 1
modules/UI/side_pannels/settings/SettingsMenu.js 查看文件

26
 var SettingsMenu = {
26
 var SettingsMenu = {
27
 
27
 
28
     init: function () {
28
     init: function () {
29
-        $("#updateSettings").before(generateLanguagesSelectBox());
29
+        $("#startMutedOptions").before(generateLanguagesSelectBox());
30
         APP.translation.translateElement($("#languages_selectbox"));
30
         APP.translation.translateElement($("#languages_selectbox"));
31
         $('#settingsmenu>input').keyup(function(event){
31
         $('#settingsmenu>input').keyup(function(event){
32
             if(event.keyCode === 13) {//enter
32
             if(event.keyCode === 13) {//enter
34
             }
34
             }
35
         });
35
         });
36
 
36
 
37
+        if(APP.xmpp.isModerator())
38
+        {
39
+            $("#startMutedOptions").css("display", "block");
40
+        }
41
+        else
42
+        {
43
+            $("#startMutedOptions").css("display", "none");
44
+        }
45
+
37
         $("#updateSettings").click(function () {
46
         $("#updateSettings").click(function () {
38
             SettingsMenu.update();
47
             SettingsMenu.update();
39
         });
48
         });
40
     },
49
     },
41
 
50
 
51
+    onRoleChanged: function () {
52
+        if(APP.xmpp.isModerator())
53
+        {
54
+            $("#startMutedOptions").css("display", "block");
55
+        }
56
+        else
57
+        {
58
+            $("#startMutedOptions").css("display", "none");
59
+        }
60
+    },
61
+
62
+    setStartMuted: function (audio, video) {
63
+        $("#startAudioMuted").attr("checked", audio);
64
+        $("#startVideoMuted").attr("checked", video);
65
+    },
66
+
42
     update: function() {
67
     update: function() {
43
         var newDisplayName = UIUtil.escapeHtml($('#setDisplayName').get(0).value);
68
         var newDisplayName = UIUtil.escapeHtml($('#setDisplayName').get(0).value);
44
         var newEmail = UIUtil.escapeHtml($('#setEmail').get(0).value);
69
         var newEmail = UIUtil.escapeHtml($('#setEmail').get(0).value);
55
         APP.xmpp.addToPresence("email", newEmail);
80
         APP.xmpp.addToPresence("email", newEmail);
56
         var email = Settings.setEmail(newEmail);
81
         var email = Settings.setEmail(newEmail);
57
 
82
 
83
+        var startAudioMuted = ($("#startAudioMuted").is(":checked"));
84
+        var startVideoMuted = ($("#startVideoMuted").is(":checked"));
85
+        APP.xmpp.addToPresence("startMuted",
86
+            [startAudioMuted, startVideoMuted]);
58
 
87
 
59
         Avatar.setUserAvatar(APP.xmpp.myJid(), email);
88
         Avatar.setUserAvatar(APP.xmpp.myJid(), email);
60
     },
89
     },

+ 14
- 0
modules/xmpp/moderator.js 查看文件

177
                 { name: 'openSctp', value: config.openSctp})
177
                 { name: 'openSctp', value: config.openSctp})
178
                 .up();
178
                 .up();
179
         }
179
         }
180
+        if(config.startAudioMuted !== undefined)
181
+        {
182
+            elem.c(
183
+                'property',
184
+                { name: 'startAudioMuted', value: config.startAudioMuted})
185
+                .up();
186
+        }
187
+        if(config.startVideoMuted !== undefined)
188
+        {
189
+            elem.c(
190
+                'property',
191
+                { name: 'startVideoMuted', value: config.startVideoMuted})
192
+                .up();
193
+        }
180
         elem.up();
194
         elem.up();
181
         return elem;
195
         return elem;
182
     },
196
     },

+ 19
- 0
modules/xmpp/strophe.emuc.js 查看文件

152
                 $(document).trigger('videomuted.muc', [from, videoMuted.text()]);
152
                 $(document).trigger('videomuted.muc', [from, videoMuted.text()]);
153
             }
153
             }
154
 
154
 
155
+            var startMuted = $(pres).find('>startmuted');
156
+            if (startMuted.length)
157
+            {
158
+                eventEmitter.emit(XMPPEvents.START_MUTED,
159
+                    startMuted.attr("audio") === "true", startMuted.attr("video") === "true");
160
+            }
161
+
155
             var devices = $(pres).find('>devices');
162
             var devices = $(pres).find('>devices');
156
             if(devices.length)
163
             if(devices.length)
157
             {
164
             {
506
                                     || 'sendrecv' }
513
                                     || 'sendrecv' }
507
                         ).up();
514
                         ).up();
508
                     }
515
                     }
516
+                pres.up();
517
+            }
518
+
519
+            if(this.presMap["startMuted"] !== undefined)
520
+            {
521
+                pres.c("startmuted", {audio: this.presMap["startMuted"].audio,
522
+                    video: this.presMap["startMuted"].video,
523
+                    xmlns: "http://jitsi.org/jitmeet/start-muted"});
524
+                delete this.presMap["startMuted"];
509
             }
525
             }
510
 
526
 
511
             pres.up();
527
             pres.up();
586
         addUserIdToPresence: function (userId) {
602
         addUserIdToPresence: function (userId) {
587
             this.presMap['userId'] = userId;
603
             this.presMap['userId'] = userId;
588
         },
604
         },
605
+        addStartMutedToPresence: function (audio, video) {
606
+            this.presMap["startMuted"] = {audio: audio, video: video};
607
+        },
589
         isModerator: function () {
608
         isModerator: function () {
590
             return this.role === 'moderator';
609
             return this.role === 'moderator';
591
         },
610
         },

+ 8
- 0
modules/xmpp/strophe.jingle.js 查看文件

108
             // see http://xmpp.org/extensions/xep-0166.html#concepts-session
108
             // see http://xmpp.org/extensions/xep-0166.html#concepts-session
109
             switch (action) {
109
             switch (action) {
110
                 case 'session-initiate':
110
                 case 'session-initiate':
111
+                    var startMuted = $(iq).find('jingle>startmuted');
112
+                    if(startMuted && startMuted.length > 0)
113
+                    {
114
+                        var audioMuted = startMuted.attr("audio");
115
+                        var videoMuted = startMuted.attr("video");
116
+                        APP.UI.setInitialMuteFromFocus((audioMuted === "true"),
117
+                            (videoMuted === "true"));
118
+                    }
111
                     sess = new JingleSession(
119
                     sess = new JingleSession(
112
                         $(iq).attr('to'), $(iq).find('jingle').attr('sid'),
120
                         $(iq).attr('to'), $(iq).find('jingle').attr('sid'),
113
                         this.connection, XMPP);
121
                         this.connection, XMPP);

+ 6
- 0
modules/xmpp/xmpp.js 查看文件

481
             case "devices":
481
             case "devices":
482
                 connection.emuc.addDevicesToPresence(value);
482
                 connection.emuc.addDevicesToPresence(value);
483
                 break;
483
                 break;
484
+            case "startMuted":
485
+                if(!Moderator.isModerator())
486
+                    return;
487
+                connection.emuc.addStartMutedToPresence(value[0],
488
+                    value[1]);
489
+                break;
484
             default :
490
             default :
485
                 console.log("Unknown tag for presence: " + name);
491
                 console.log("Unknown tag for presence: " + name);
486
                 return;
492
                 return;

+ 2
- 1
service/xmpp/XMPPEvents.js 查看文件

29
     AUTHENTICATION_REQUIRED: "xmpp.authentication_required",
29
     AUTHENTICATION_REQUIRED: "xmpp.authentication_required",
30
     CHAT_ERROR_RECEIVED: "xmpp.chat_error_received",
30
     CHAT_ERROR_RECEIVED: "xmpp.chat_error_received",
31
     ETHERPAD: "xmpp.etherpad",
31
     ETHERPAD: "xmpp.etherpad",
32
-    DEVICE_AVAILABLE: "xmpp.device_available"
32
+    DEVICE_AVAILABLE: "xmpp.device_available",
33
+    START_MUTED: "xmpp.start_muted"
33
 };
34
 };
34
 module.exports = XMPPEvents;
35
 module.exports = XMPPEvents;

Loading…
取消
儲存