Kaynağa Gözat

Moves some methods from avatar to videolayout.

master
hristoterezov 10 yıl önce
ebeveyn
işleme
f11c3b94ed

+ 1
- 1
index.html Dosyayı Görüntüle

@@ -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=91"></script>
25
+    <script src="libs/app.bundle.js?v=92"></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">

+ 187
- 161
libs/app.bundle.js Dosyayı Görüntüle

@@ -972,6 +972,19 @@ var RTC = {
972 972
         oldStream.stop();
973 973
         APP.xmpp.switchStreams(newStream, oldStream, callback, true);
974 974
     },
975
+    isVideoMuted: function (jid) {
976
+        if (jid === APP.xmpp.myJid()) {
977
+            var localVideo = APP.RTC.localVideo;
978
+            return (!localVideo || localVideo.isMuted());
979
+        }
980
+        else
981
+        {
982
+            if (!APP.RTC.remoteStreams[jid] || !APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE]) {
983
+                return null;
984
+            }
985
+            return APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE].muted;
986
+        }
987
+    },
975 988
     /**
976 989
      * Checks if video identified by given src is desktop stream.
977 990
      * @param videoSrc eg.
@@ -1747,6 +1760,8 @@ function registerListeners() {
1747 1760
             VideoLayout.setDeviceAvailabilityIcons(resource, devices);
1748 1761
         });
1749 1762
 
1763
+    APP.xmpp.addListener(XMPPEvents.AUDIO_MUTED, VideoLayout.onAudioMute);
1764
+    APP.xmpp.addListener(XMPPEvents.VIDEO_MUTED, VideoLayout.onVideoMute);
1750 1765
     APP.members.addListener(MemberEvents.DTMF_SUPPORT_CHANGED,
1751 1766
                             onDtmfSupportChanged);
1752 1767
     APP.xmpp.addListener(XMPPEvents.START_MUTED, function (audio, video) {
@@ -2305,6 +2320,12 @@ UI.setVideoMuteButtonsState = function (mute) {
2305 2320
     }
2306 2321
 }
2307 2322
 
2323
+UI.userAvatarChanged = function (resourceJid, thumbUrl, contactListUrl) {
2324
+    VideoLayout.userAvatarChanged(resourceJid, thumbUrl);
2325
+    ContactList.userAvatarChanged(resourceJid, contactListUrl);
2326
+    if(resourceJid === APP.xmpp.myResource())
2327
+        SettingsMenu.changeAvatar(thumbUrl);
2328
+}
2308 2329
 
2309 2330
 UI.setVideoMute = setVideoMute;
2310 2331
 
@@ -3045,46 +3066,8 @@ var LoginDialog = {
3045 3066
 module.exports = LoginDialog;
3046 3067
 },{"../../xmpp/moderator":56,"../../xmpp/xmpp":64}],14:[function(require,module,exports){
3047 3068
 var Settings = require("../../settings/Settings");
3048
-var MediaStreamType = require("../../../service/RTC/MediaStreamTypes");
3049 3069
 
3050 3070
 var users = {};
3051
-var activeSpeakerJid;
3052
-
3053
-function setVisibility(selector, show) {
3054
-    if (selector && selector.length > 0) {
3055
-        selector.css("visibility", show ? "visible" : "hidden");
3056
-    }
3057
-}
3058
-
3059
-function isUserMuted(jid) {
3060
-    // XXX(gp) we may want to rename this method to something like
3061
-    // isUserStreaming, for example.
3062
-    if (jid != APP.xmpp.myJid()) {
3063
-        var resource = Strophe.getResourceFromJid(jid);
3064
-        if (!require("../videolayout/VideoLayout").isInLastN(resource)) {
3065
-            return true;
3066
-        }
3067
-    }
3068
-    else
3069
-    {
3070
-        var localVideo = APP.RTC.localVideo;
3071
-        return (!localVideo || localVideo.isMuted());
3072
-    }
3073
-
3074
-    if (!APP.RTC.remoteStreams[jid] || !APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE]) {
3075
-        return null;
3076
-    }
3077
-    return APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE].muted;
3078
-}
3079
-
3080
-function getGravatarUrl(id, size) {
3081
-    if(id === APP.xmpp.myJid() || !id) {
3082
-        id = Settings.getSettings().uid;
3083
-    }
3084
-    return 'https://www.gravatar.com/avatar/' +
3085
-        MD5.hexdigest(id.trim().toLowerCase()) +
3086
-        "?d=wavatar&size=" + (size || "30");
3087
-}
3088 3071
 
3089 3072
 var Avatar = {
3090 3073
 
@@ -3101,107 +3084,26 @@ var Avatar = {
3101 3084
             }
3102 3085
             users[jid] = id;
3103 3086
         }
3104
-        var thumbUrl = getGravatarUrl(users[jid] || jid, 100);
3105
-        var contactListUrl = getGravatarUrl(users[jid] || jid);
3087
+        var thumbUrl = this.getGravatarUrl(users[jid] || jid, 100);
3088
+        var contactListUrl = this.getGravatarUrl(users[jid] || jid);
3106 3089
         var resourceJid = Strophe.getResourceFromJid(jid);
3107
-        var thumbnail = $('#participant_' + resourceJid);
3108
-        var avatar = $('#avatar_' + resourceJid);
3109 3090
 
3110
-        // set the avatar in the settings menu if it is local user and get the
3111
-        // local video container
3112
-        if (jid === APP.xmpp.myJid()) {
3113
-            $('#avatar').get(0).src = thumbUrl;
3114
-            thumbnail = $('#localVideoContainer');
3115
-        }
3116
-
3117
-        // set the avatar in the contact list
3118
-        var contact = $('#' + resourceJid + '>img');
3119
-        if (contact && contact.length > 0) {
3120
-            contact.get(0).src = contactListUrl;
3121
-        }
3122
-
3123
-        // set the avatar in the thumbnail
3124
-        if (avatar && avatar.length > 0) {
3125
-            avatar[0].src = thumbUrl;
3126
-        } else {
3127
-            if (thumbnail && thumbnail.length > 0) {
3128
-                avatar = document.createElement('img');
3129
-                avatar.id = 'avatar_' + resourceJid;
3130
-                avatar.className = 'userAvatar';
3131
-                avatar.src = thumbUrl;
3132
-                thumbnail.append(avatar);
3133
-            }
3134
-        }
3135
-
3136
-        //if the user is the current active speaker - update the active speaker
3137
-        // avatar
3138
-        if (jid === activeSpeakerJid) {
3139
-            this.updateActiveSpeakerAvatarSrc(jid);
3140
-        }
3091
+        APP.UI.userAvatarChanged(resourceJid, thumbUrl, contactListUrl);
3141 3092
     },
3142
-
3143
-    /**
3144
-     * Hides or shows the user's avatar
3145
-     * @param jid jid of the user
3146
-     * @param show whether we should show the avatar or not
3147
-     * video because there is no dominant speaker and no focused speaker
3148
-     */
3149
-    showUserAvatar: function (jid, show) {
3150
-        if (users[jid]) {
3151
-            var resourceJid = Strophe.getResourceFromJid(jid);
3152
-            var video = $('#participant_' + resourceJid + '>video');
3153
-            var avatar = $('#avatar_' + resourceJid);
3154
-
3155
-            if (jid === APP.xmpp.myJid()) {
3156
-                video = $('#localVideoWrapper>video');
3157
-            }
3158
-            if (show === undefined || show === null) {
3159
-                show = isUserMuted(jid);
3160
-            }
3161
-
3162
-            //if the user is the currently focused, the dominant speaker or if
3163
-            //there is no focused and no dominant speaker and the large video is
3164
-            //currently shown
3165
-            if (activeSpeakerJid === jid && require("../videolayout/LargeVideo").isLargeVideoOnTop()) {
3166
-                setVisibility($("#largeVideo"), !show);
3167
-                setVisibility($('#activeSpeaker'), show);
3168
-                setVisibility(avatar, false);
3169
-                setVisibility(video, false);
3170
-            } else {
3171
-                if (video && video.length > 0) {
3172
-                    setVisibility(video, !show);
3173
-                }
3174
-                setVisibility(avatar, show);
3175
-
3176
-            }
3177
-        }
3178
-    },
3179
-
3180
-    /**
3181
-     * Updates the src of the active speaker avatar
3182
-     * @param jid of the current active speaker
3183
-     */
3184
-    updateActiveSpeakerAvatarSrc: function (jid) {
3185
-        var avatar = $("#activeSpeakerAvatar")[0];
3186
-        var url = getGravatarUrl(users[jid],
3187
-            interfaceConfig.ACTIVE_SPEAKER_AVATAR_SIZE);
3188
-        if (jid === activeSpeakerJid && avatar.src === url) {
3189
-            return;
3190
-        }
3191
-        activeSpeakerJid = jid;
3192
-        var isMuted = isUserMuted(jid);
3193
-        if (jid && isMuted !== null) {
3194
-            avatar.src = url;
3195
-            setVisibility($("#largeVideo"), !isMuted);
3196
-            Avatar.showUserAvatar(jid, isMuted);
3093
+    getGravatarUrl: function (id, size) {
3094
+        if(id === APP.xmpp.myJid() || !id) {
3095
+            id = Settings.getSettings().uid;
3197 3096
         }
3097
+        return 'https://www.gravatar.com/avatar/' +
3098
+            MD5.hexdigest(id.trim().toLowerCase()) +
3099
+            "?d=wavatar&size=" + (size || "30");
3198 3100
     }
3199 3101
 
3200 3102
 };
3201 3103
 
3202 3104
 
3203 3105
 module.exports = Avatar;
3204
-},{"../../../service/RTC/MediaStreamTypes":100,"../../settings/Settings":45,"../videolayout/LargeVideo":33,"../videolayout/VideoLayout":37}],15:[function(require,module,exports){
3106
+},{"../../settings/Settings":45}],15:[function(require,module,exports){
3205 3107
 /* global $, config,
3206 3108
    setLargeVideoVisible, Util */
3207 3109
 
@@ -4981,6 +4883,15 @@ var ContactList = {
4981 4883
 
4982 4884
         if (contactName && displayName && displayName.length > 0)
4983 4885
             contactName.html(displayName);
4886
+    },
4887
+
4888
+    userAvatarChanged: function (resourceJid, contactListUrl) {
4889
+        // set the avatar in the contact list
4890
+        var contact = $('#' + resourceJid + '>img');
4891
+        if (contact && contact.length > 0) {
4892
+            contact.get(0).src = contactListUrl;
4893
+        }
4894
+
4984 4895
     }
4985 4896
 };
4986 4897
 
@@ -5090,6 +5001,9 @@ var SettingsMenu = {
5090 5001
             peerJid === APP.xmpp.myJid()) {
5091 5002
             this.setDisplayName(newDisplayName);
5092 5003
         }
5004
+    },
5005
+    changeAvatar: function (thumbUrl) {
5006
+        $('#avatar').get(0).src = thumbUrl;
5093 5007
     }
5094 5008
 };
5095 5009
 
@@ -6952,9 +6866,34 @@ function getCameraVideoSize(videoWidth,
6952 6866
     return [availableWidth, availableHeight];
6953 6867
 }
6954 6868
 
6869
+/**
6870
+ * Updates the src of the active speaker avatar
6871
+ * @param jid of the current active speaker
6872
+ */
6873
+function updateActiveSpeakerAvatarSrc() {
6874
+    var avatar = $("#activeSpeakerAvatar")[0];
6875
+    var jid = currentSmallVideo.peerJid;
6876
+    var url = Avatar.getGravatarUrl(jid);
6877
+    if(avatar.src === url)
6878
+        return;
6879
+    var isMuted = null;
6880
+    if(!LargeVideo.VideoLayout.isInLastN(currentSmallVideo.resourceJid)) {
6881
+        isMuted = true;
6882
+    }
6883
+    else
6884
+    {
6885
+        isMuted = APP.RTC.isVideoMuted(jid);
6886
+    }
6887
+
6888
+    if (jid && isMuted !== null) {
6889
+        avatar.src = url;
6890
+        $("#largeVideo").css("visibility", isMuted ? "hidden" : "visible");
6891
+        currentSmallVideo.showAvatar(isMuted);
6892
+    }
6893
+}
6955 6894
 
6956 6895
 function changeVideo(isVisible) {
6957
-    Avatar.updateActiveSpeakerAvatarSrc(currentSmallVideo.peerJid);
6896
+    updateActiveSpeakerAvatarSrc();
6958 6897
 
6959 6898
     APP.RTC.setVideoSrc($('#largeVideo')[0], currentSmallVideo.getSrc());
6960 6899
 
@@ -7001,7 +6940,7 @@ function changeVideo(isVisible) {
7001 6940
     }
7002 6941
 
7003 6942
     if(oldSmallVideo)
7004
-        Avatar.showUserAvatar(oldSmallVideo.peerJid);
6943
+        oldSmallVideo.showAvatar();
7005 6944
 }
7006 6945
 
7007 6946
 var LargeVideo = {
@@ -7057,10 +6996,9 @@ var LargeVideo = {
7057 6996
 
7058 6997
             video.fadeOut(300, changeVideo.bind(video, this.isLargeVideoVisible()));
7059 6998
         } else {
7060
-            var jid = null;
7061
-            if(currentSmallVideo)
7062
-                jid = currentSmallVideo.peerJid;
7063
-            Avatar.showUserAvatar(jid);
6999
+            if(currentSmallVideo) {
7000
+                currentSmallVideo.showAvatar();
7001
+            }
7064 7002
         }
7065 7003
 
7066 7004
     },
@@ -7187,7 +7125,22 @@ var LargeVideo = {
7187 7125
     getResourceJid: function () {
7188 7126
         if(!currentSmallVideo)
7189 7127
             return null;
7190
-        return currentSmallVideo.peerJid;
7128
+        return currentSmallVideo.resourceJid;
7129
+    },
7130
+    updateAvatar: function (resourceJid) {
7131
+        if (resourceJid === this.getResourceJid()) {
7132
+            updateActiveSpeakerAvatarSrc();
7133
+        }
7134
+    },
7135
+    showAvatar: function (resourceJid, show) {
7136
+        if(this.getResourceJid() === resourceJid
7137
+            && LargeVideo.isLargeVideoOnTop())
7138
+        {
7139
+            $("#largeVideo").css("visibility", show ? "hidden" : "visible");
7140
+            $('#activeSpeaker').css("visibility", show ? "visible" : "hidden");
7141
+            return true;
7142
+        }
7143
+        return false;
7191 7144
     }
7192 7145
 
7193 7146
 }
@@ -7412,7 +7365,7 @@ LocalVideo.prototype.changeVideo = function (stream, isMuted) {
7412 7365
     // Add stream ended handler
7413 7366
     stream.getOriginalStream().onended = function () {
7414 7367
         localVideoContainer.removeChild(localVideo);
7415
-        self.VideoLayout.updateRemovedVideo(APP.RTC.getVideoSrc(localVideo));
7368
+        self.VideoLayout.updateRemovedVideo(APP.xmpp.myResource());
7416 7369
     };
7417 7370
 }
7418 7371
 
@@ -7558,10 +7511,8 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
7558 7511
         return false;
7559 7512
 
7560 7513
     var select = null;
7561
-    var removedVideoSrc = null;
7562 7514
     if (isVideo) {
7563 7515
         select = $('#' + id);
7564
-        removedVideoSrc = APP.RTC.getVideoSrc(select.get(0));
7565 7516
     }
7566 7517
     else
7567 7518
         select = $('#' + this.videoSpanId + '>audio');
@@ -7585,8 +7536,8 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
7585 7536
         this.VideoLayout.resizeThumbnails();
7586 7537
     }
7587 7538
 
7588
-    if (removedVideoSrc)
7589
-        this.VideoLayout.updateRemovedVideo(removedVideoSrc);
7539
+    if (isVideo)
7540
+        this.VideoLayout.updateRemovedVideo(this.resourceJid);
7590 7541
 };
7591 7542
 
7592 7543
 RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
@@ -7695,7 +7646,7 @@ RemoteVideo.prototype.showPeerContainer = function (state) {
7695 7646
             $(this.container).show();
7696 7647
         }
7697 7648
 
7698
-        Avatar.showUserAvatar(this.peerJid, (state !== 'show'));
7649
+        this.showAvatar(state !== 'show');
7699 7650
     }
7700 7651
     else if ($(this.container).is(':visible') && isHide)
7701 7652
     {
@@ -7820,6 +7771,7 @@ RemoteVideo.createContainer = function (spanId) {
7820 7771
     return remotes.appendChild(container);
7821 7772
 };
7822 7773
 
7774
+
7823 7775
 module.exports = RemoteVideo;
7824 7776
 },{"../audio_levels/AudioLevels":10,"../avatar/Avatar":14,"./ConnectionIndicator":32,"./LargeVideo":33,"./SmallVideo":36}],36:[function(require,module,exports){
7825 7777
 var UIUtil = require("../util/UIUtil");
@@ -7827,6 +7779,13 @@ var LargeVideo = require("./LargeVideo");
7827 7779
 
7828 7780
 function SmallVideo(){
7829 7781
     this.isMuted = false;
7782
+    this.hasAvatar = false;
7783
+}
7784
+
7785
+function setVisibility(selector, show) {
7786
+    if (selector && selector.length > 0) {
7787
+        selector.css("visibility", show ? "visible" : "hidden");
7788
+    }
7830 7789
 }
7831 7790
 
7832 7791
 SmallVideo.prototype.showDisplayName = function(isShow) {
@@ -7973,6 +7932,8 @@ SmallVideo.prototype.showAudioIndicator = function(isMuted) {
7973 7932
  * Shows video muted indicator over small videos.
7974 7933
  */
7975 7934
 SmallVideo.prototype.showVideoIndicator = function(isMuted) {
7935
+    this.showAvatar(isMuted);
7936
+
7976 7937
     var videoMutedSpan = $('#' + this.videoSpanId + '>span.videoMuted');
7977 7938
 
7978 7939
     if (isMuted === false) {
@@ -8035,6 +7996,8 @@ SmallVideo.prototype.enableDominantSpeaker = function (isEnable)
8035 7996
                 this.container.classList.remove("dominantspeaker");
8036 7997
         }
8037 7998
     }
7999
+
8000
+    this.showAvatar();
8038 8001
 };
8039 8002
 
8040 8003
 SmallVideo.prototype.updateIconPositions = function () {
@@ -8106,6 +8069,61 @@ SmallVideo.prototype.hasVideo = function () {
8106 8069
     return $("#" + this.videoSpanId).find("video").length !== 0;
8107 8070
 }
8108 8071
 
8072
+/**
8073
+ * Hides or shows the user's avatar
8074
+ * @param show whether we should show the avatar or not
8075
+ * video because there is no dominant speaker and no focused speaker
8076
+ */
8077
+SmallVideo.prototype.showAvatar = function (show) {
8078
+    if(!this.hasAvatar)
8079
+        return;
8080
+
8081
+    var video = $('#' + this.videoSpanId).find("video");
8082
+    var avatar = $('#avatar_' + this.resourceJid);
8083
+
8084
+    if (show === undefined || show === null) {
8085
+        if(!this.VideoLayout.isInLastN(this.resourceJid)) {
8086
+            show = true;
8087
+        }
8088
+        else
8089
+        {
8090
+            show = APP.RTC.isVideoMuted(this.peerJid);
8091
+        }
8092
+
8093
+    }
8094
+
8095
+    if (LargeVideo.showAvatar(this.resourceJid, show))
8096
+    {
8097
+        setVisibility(avatar, false);
8098
+        setVisibility(video, false);
8099
+    } else {
8100
+        if (video && video.length > 0) {
8101
+            setVisibility(video, !show);
8102
+        }
8103
+        setVisibility(avatar, show);
8104
+
8105
+    }
8106
+}
8107
+
8108
+SmallVideo.prototype.avatarChanged = function (thumbUrl) {
8109
+    var thumbnail = $('#' + this.videoSpanId);
8110
+    var avatar = $('#avatar_' + this.resourceJid);
8111
+    this.hasAvatar = true;
8112
+
8113
+    // set the avatar in the thumbnail
8114
+    if (avatar && avatar.length > 0) {
8115
+        avatar[0].src = thumbUrl;
8116
+    } else {
8117
+        if (thumbnail && thumbnail.length > 0) {
8118
+            avatar = document.createElement('img');
8119
+            avatar.id = 'avatar_' + this.resourceJid;
8120
+            avatar.className = 'userAvatar';
8121
+            avatar.src = thumbUrl;
8122
+            thumbnail.append(avatar);
8123
+        }
8124
+    }
8125
+}
8126
+
8109 8127
 module.exports = SmallVideo;
8110 8128
 },{"../util/UIUtil":31,"./LargeVideo":33}],37:[function(require,module,exports){
8111 8129
 var AudioLevels = require("../audio_levels/AudioLevels");
@@ -8519,9 +8537,6 @@ var VideoLayout = (function (my) {
8519 8537
             remoteVideos[resourceJid].enableDominantSpeaker(isEnable);
8520 8538
         }
8521 8539
 
8522
-
8523
-        Avatar.showUserAvatar(
8524
-            APP.xmpp.findJidFromResource(resourceJid));
8525 8540
     };
8526 8541
 
8527 8542
     /**
@@ -8626,7 +8641,7 @@ var VideoLayout = (function (my) {
8626 8641
     /**
8627 8642
      * On audio muted event.
8628 8643
      */
8629
-    $(document).bind('audiomuted.muc', function (event, jid, isMuted) {
8644
+    my.onAudioMute = function (jid, isMuted) {
8630 8645
         var resourceJid = Strophe.getResourceFromJid(jid);
8631 8646
         if (resourceJid === APP.xmpp.myResource()) {
8632 8647
             localVideoThumbnail.showAudioIndicator(isMuted);
@@ -8639,24 +8654,22 @@ var VideoLayout = (function (my) {
8639 8654
         }
8640 8655
 
8641 8656
 
8642
-    });
8657
+    };
8643 8658
 
8644 8659
     /**
8645 8660
      * On video muted event.
8646 8661
      */
8647
-    $(document).bind('videomuted.muc', function (event, jid, value) {
8648
-        var isMuted = (value === "true");
8649
-        if(jid !== APP.xmpp.myJid() && !APP.RTC.muteRemoteVideoStream(jid, isMuted))
8662
+    my.onVideoMute = function (jid, value) {
8663
+        if(jid !== APP.xmpp.myJid() && !APP.RTC.muteRemoteVideoStream(jid, value))
8650 8664
             return;
8651 8665
 
8652
-        Avatar.showUserAvatar(jid, isMuted);
8653 8666
         if (jid === APP.xmpp.myJid()) {
8654
-            localVideoThumbnail.showVideoIndicator(isMuted);
8667
+            localVideoThumbnail.showVideoIndicator(value);
8655 8668
         } else {
8656 8669
             VideoLayout.ensurePeerContainerExists(jid);
8657
-            remoteVideos[Strophe.getResourceFromJid(jid)].showVideoIndicator(isMuted);
8670
+            remoteVideos[Strophe.getResourceFromJid(jid)].showVideoIndicator(value);
8658 8671
         }
8659
-    });
8672
+    };
8660 8673
 
8661 8674
     /**
8662 8675
      * Display name changed.
@@ -8960,10 +8973,8 @@ var VideoLayout = (function (my) {
8960 8973
             var smallVideo = VideoLayout.getSmallVideo(focusedVideoResourceJid);
8961 8974
             if(smallVideo)
8962 8975
                 smallVideo.focus(false);
8963
-            Avatar.showUserAvatar(
8964
-                APP.xmpp.findJidFromResource(focusedVideoResourceJid));
8976
+            smallVideo.showAvatar();
8965 8977
             focusedVideoResourceJid = null;
8966
-
8967 8978
         }
8968 8979
     }
8969 8980
 
@@ -8989,7 +9000,16 @@ var VideoLayout = (function (my) {
8989 9000
                 return null;
8990 9001
             return remoteVideos[resourceJid];
8991 9002
         }
8992
-    }
9003
+    };
9004
+
9005
+    my.userAvatarChanged = function(resourceJid, thumbUrl)
9006
+    {
9007
+        var smallVideo = VideoLayout.getSmallVideo(resourceJid);
9008
+        if(smallVideo)
9009
+            smallVideo.avatarChanged(thumbUrl);
9010
+        LargeVideo.updateAvatar(resourceJid, thumbUrl);
9011
+    };
9012
+
8993 9013
     return my;
8994 9014
 }(VideoLayout || {}));
8995 9015
 
@@ -14966,13 +14986,17 @@ module.exports = function(XMPP, eventEmitter) {
14966 14986
             // Parse audio info tag.
14967 14987
             var audioMuted = $(pres).find('>audiomuted');
14968 14988
             if (audioMuted.length) {
14969
-                $(document).trigger('audiomuted.muc', [from, audioMuted.text()]);
14989
+                eventEmitter.emit(XMPPEvents.AUDIO_MUTED,
14990
+                    from, (audioMuted.text() === "true"));
14991
+                $(document).trigger('audiomuted.muc', [from, ]);
14970 14992
             }
14971 14993
 
14972 14994
             // Parse video info tag.
14973 14995
             var videoMuted = $(pres).find('>videomuted');
14974 14996
             if (videoMuted.length) {
14975
-                $(document).trigger('videomuted.muc', [from, videoMuted.text()]);
14997
+                eventEmitter.emit(XMPPEvents.VIDEO_MUTED,
14998
+                    from, (videoMuted.text() === "true"));
14999
+                $(document).trigger('videomuted.muc', [from, ]);
14976 15000
             }
14977 15001
 
14978 15002
             var startMuted = $(pres).find('>startmuted');
@@ -28356,7 +28380,9 @@ var XMPPEvents = {
28356 28380
     DEVICE_AVAILABLE: "xmpp.device_available",
28357 28381
     START_MUTED: "xmpp.start_muted",
28358 28382
     PEERCONNECTION_READY: "xmpp.peerconnection_ready",
28359
-    CONFERENCE_SETUP_FAILED: "xmpp.conference_setup_failed"
28383
+    CONFERENCE_SETUP_FAILED: "xmpp.conference_setup_failed",
28384
+    AUDIO_MUTED: "xmpp.audio_muted",
28385
+    VIDEO_MUTED: "xmpp.video_muted"
28360 28386
 };
28361 28387
 module.exports = XMPPEvents;
28362 28388
 },{}],112:[function(require,module,exports){

+ 13
- 0
modules/RTC/RTC.js Dosyayı Görüntüle

@@ -225,6 +225,19 @@ var RTC = {
225 225
         oldStream.stop();
226 226
         APP.xmpp.switchStreams(newStream, oldStream, callback, true);
227 227
     },
228
+    isVideoMuted: function (jid) {
229
+        if (jid === APP.xmpp.myJid()) {
230
+            var localVideo = APP.RTC.localVideo;
231
+            return (!localVideo || localVideo.isMuted());
232
+        }
233
+        else
234
+        {
235
+            if (!APP.RTC.remoteStreams[jid] || !APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE]) {
236
+                return null;
237
+            }
238
+            return APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE].muted;
239
+        }
240
+    },
228 241
     /**
229 242
      * Checks if video identified by given src is desktop stream.
230 243
      * @param videoSrc eg.

+ 8
- 0
modules/UI/UI.js Dosyayı Görüntüle

@@ -240,6 +240,8 @@ function registerListeners() {
240 240
             VideoLayout.setDeviceAvailabilityIcons(resource, devices);
241 241
         });
242 242
 
243
+    APP.xmpp.addListener(XMPPEvents.AUDIO_MUTED, VideoLayout.onAudioMute);
244
+    APP.xmpp.addListener(XMPPEvents.VIDEO_MUTED, VideoLayout.onVideoMute);
243 245
     APP.members.addListener(MemberEvents.DTMF_SUPPORT_CHANGED,
244 246
                             onDtmfSupportChanged);
245 247
     APP.xmpp.addListener(XMPPEvents.START_MUTED, function (audio, video) {
@@ -798,6 +800,12 @@ UI.setVideoMuteButtonsState = function (mute) {
798 800
     }
799 801
 }
800 802
 
803
+UI.userAvatarChanged = function (resourceJid, thumbUrl, contactListUrl) {
804
+    VideoLayout.userAvatarChanged(resourceJid, thumbUrl);
805
+    ContactList.userAvatarChanged(resourceJid, contactListUrl);
806
+    if(resourceJid === APP.xmpp.myResource())
807
+        SettingsMenu.changeAvatar(thumbUrl);
808
+}
801 809
 
802 810
 UI.setVideoMute = setVideoMute;
803 811
 

+ 9
- 128
modules/UI/avatar/Avatar.js Dosyayı Görüntüle

@@ -1,44 +1,6 @@
1 1
 var Settings = require("../../settings/Settings");
2
-var MediaStreamType = require("../../../service/RTC/MediaStreamTypes");
3 2
 
4 3
 var users = {};
5
-var activeSpeakerJid;
6
-
7
-function setVisibility(selector, show) {
8
-    if (selector && selector.length > 0) {
9
-        selector.css("visibility", show ? "visible" : "hidden");
10
-    }
11
-}
12
-
13
-function isUserMuted(jid) {
14
-    // XXX(gp) we may want to rename this method to something like
15
-    // isUserStreaming, for example.
16
-    if (jid != APP.xmpp.myJid()) {
17
-        var resource = Strophe.getResourceFromJid(jid);
18
-        if (!require("../videolayout/VideoLayout").isInLastN(resource)) {
19
-            return true;
20
-        }
21
-    }
22
-    else
23
-    {
24
-        var localVideo = APP.RTC.localVideo;
25
-        return (!localVideo || localVideo.isMuted());
26
-    }
27
-
28
-    if (!APP.RTC.remoteStreams[jid] || !APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE]) {
29
-        return null;
30
-    }
31
-    return APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE].muted;
32
-}
33
-
34
-function getGravatarUrl(id, size) {
35
-    if(id === APP.xmpp.myJid() || !id) {
36
-        id = Settings.getSettings().uid;
37
-    }
38
-    return 'https://www.gravatar.com/avatar/' +
39
-        MD5.hexdigest(id.trim().toLowerCase()) +
40
-        "?d=wavatar&size=" + (size || "30");
41
-}
42 4
 
43 5
 var Avatar = {
44 6
 
@@ -55,100 +17,19 @@ var Avatar = {
55 17
             }
56 18
             users[jid] = id;
57 19
         }
58
-        var thumbUrl = getGravatarUrl(users[jid] || jid, 100);
59
-        var contactListUrl = getGravatarUrl(users[jid] || jid);
20
+        var thumbUrl = this.getGravatarUrl(users[jid] || jid, 100);
21
+        var contactListUrl = this.getGravatarUrl(users[jid] || jid);
60 22
         var resourceJid = Strophe.getResourceFromJid(jid);
61
-        var thumbnail = $('#participant_' + resourceJid);
62
-        var avatar = $('#avatar_' + resourceJid);
63
-
64
-        // set the avatar in the settings menu if it is local user and get the
65
-        // local video container
66
-        if (jid === APP.xmpp.myJid()) {
67
-            $('#avatar').get(0).src = thumbUrl;
68
-            thumbnail = $('#localVideoContainer');
69
-        }
70
-
71
-        // set the avatar in the contact list
72
-        var contact = $('#' + resourceJid + '>img');
73
-        if (contact && contact.length > 0) {
74
-            contact.get(0).src = contactListUrl;
75
-        }
76
-
77
-        // set the avatar in the thumbnail
78
-        if (avatar && avatar.length > 0) {
79
-            avatar[0].src = thumbUrl;
80
-        } else {
81
-            if (thumbnail && thumbnail.length > 0) {
82
-                avatar = document.createElement('img');
83
-                avatar.id = 'avatar_' + resourceJid;
84
-                avatar.className = 'userAvatar';
85
-                avatar.src = thumbUrl;
86
-                thumbnail.append(avatar);
87
-            }
88
-        }
89 23
 
90
-        //if the user is the current active speaker - update the active speaker
91
-        // avatar
92
-        if (jid === activeSpeakerJid) {
93
-            this.updateActiveSpeakerAvatarSrc(jid);
94
-        }
24
+        APP.UI.userAvatarChanged(resourceJid, thumbUrl, contactListUrl);
95 25
     },
96
-
97
-    /**
98
-     * Hides or shows the user's avatar
99
-     * @param jid jid of the user
100
-     * @param show whether we should show the avatar or not
101
-     * video because there is no dominant speaker and no focused speaker
102
-     */
103
-    showUserAvatar: function (jid, show) {
104
-        if (users[jid]) {
105
-            var resourceJid = Strophe.getResourceFromJid(jid);
106
-            var video = $('#participant_' + resourceJid + '>video');
107
-            var avatar = $('#avatar_' + resourceJid);
108
-
109
-            if (jid === APP.xmpp.myJid()) {
110
-                video = $('#localVideoWrapper>video');
111
-            }
112
-            if (show === undefined || show === null) {
113
-                show = isUserMuted(jid);
114
-            }
115
-
116
-            //if the user is the currently focused, the dominant speaker or if
117
-            //there is no focused and no dominant speaker and the large video is
118
-            //currently shown
119
-            if (activeSpeakerJid === jid && require("../videolayout/LargeVideo").isLargeVideoOnTop()) {
120
-                setVisibility($("#largeVideo"), !show);
121
-                setVisibility($('#activeSpeaker'), show);
122
-                setVisibility(avatar, false);
123
-                setVisibility(video, false);
124
-            } else {
125
-                if (video && video.length > 0) {
126
-                    setVisibility(video, !show);
127
-                }
128
-                setVisibility(avatar, show);
129
-
130
-            }
131
-        }
132
-    },
133
-
134
-    /**
135
-     * Updates the src of the active speaker avatar
136
-     * @param jid of the current active speaker
137
-     */
138
-    updateActiveSpeakerAvatarSrc: function (jid) {
139
-        var avatar = $("#activeSpeakerAvatar")[0];
140
-        var url = getGravatarUrl(users[jid],
141
-            interfaceConfig.ACTIVE_SPEAKER_AVATAR_SIZE);
142
-        if (jid === activeSpeakerJid && avatar.src === url) {
143
-            return;
144
-        }
145
-        activeSpeakerJid = jid;
146
-        var isMuted = isUserMuted(jid);
147
-        if (jid && isMuted !== null) {
148
-            avatar.src = url;
149
-            setVisibility($("#largeVideo"), !isMuted);
150
-            Avatar.showUserAvatar(jid, isMuted);
26
+    getGravatarUrl: function (id, size) {
27
+        if(id === APP.xmpp.myJid() || !id) {
28
+            id = Settings.getSettings().uid;
151 29
         }
30
+        return 'https://www.gravatar.com/avatar/' +
31
+            MD5.hexdigest(id.trim().toLowerCase()) +
32
+            "?d=wavatar&size=" + (size || "30");
152 33
     }
153 34
 
154 35
 };

+ 9
- 0
modules/UI/side_pannels/contactlist/ContactList.js Dosyayı Görüntüle

@@ -179,6 +179,15 @@ var ContactList = {
179 179
 
180 180
         if (contactName && displayName && displayName.length > 0)
181 181
             contactName.html(displayName);
182
+    },
183
+
184
+    userAvatarChanged: function (resourceJid, contactListUrl) {
185
+        // set the avatar in the contact list
186
+        var contact = $('#' + resourceJid + '>img');
187
+        if (contact && contact.length > 0) {
188
+            contact.get(0).src = contactListUrl;
189
+        }
190
+
182 191
     }
183 192
 };
184 193
 

+ 3
- 0
modules/UI/side_pannels/settings/SettingsMenu.js Dosyayı Görüntüle

@@ -102,6 +102,9 @@ var SettingsMenu = {
102 102
             peerJid === APP.xmpp.myJid()) {
103 103
             this.setDisplayName(newDisplayName);
104 104
         }
105
+    },
106
+    changeAvatar: function (thumbUrl) {
107
+        $('#avatar').get(0).src = thumbUrl;
105 108
     }
106 109
 };
107 110
 

+ 46
- 7
modules/UI/videolayout/LargeVideo.js Dosyayı Görüntüle

@@ -176,9 +176,34 @@ function getCameraVideoSize(videoWidth,
176 176
     return [availableWidth, availableHeight];
177 177
 }
178 178
 
179
+/**
180
+ * Updates the src of the active speaker avatar
181
+ * @param jid of the current active speaker
182
+ */
183
+function updateActiveSpeakerAvatarSrc() {
184
+    var avatar = $("#activeSpeakerAvatar")[0];
185
+    var jid = currentSmallVideo.peerJid;
186
+    var url = Avatar.getGravatarUrl(jid);
187
+    if(avatar.src === url)
188
+        return;
189
+    var isMuted = null;
190
+    if(!LargeVideo.VideoLayout.isInLastN(currentSmallVideo.resourceJid)) {
191
+        isMuted = true;
192
+    }
193
+    else
194
+    {
195
+        isMuted = APP.RTC.isVideoMuted(jid);
196
+    }
197
+
198
+    if (jid && isMuted !== null) {
199
+        avatar.src = url;
200
+        $("#largeVideo").css("visibility", isMuted ? "hidden" : "visible");
201
+        currentSmallVideo.showAvatar(isMuted);
202
+    }
203
+}
179 204
 
180 205
 function changeVideo(isVisible) {
181
-    Avatar.updateActiveSpeakerAvatarSrc(currentSmallVideo.peerJid);
206
+    updateActiveSpeakerAvatarSrc();
182 207
 
183 208
     APP.RTC.setVideoSrc($('#largeVideo')[0], currentSmallVideo.getSrc());
184 209
 
@@ -225,7 +250,7 @@ function changeVideo(isVisible) {
225 250
     }
226 251
 
227 252
     if(oldSmallVideo)
228
-        Avatar.showUserAvatar(oldSmallVideo.peerJid);
253
+        oldSmallVideo.showAvatar();
229 254
 }
230 255
 
231 256
 var LargeVideo = {
@@ -281,10 +306,9 @@ var LargeVideo = {
281 306
 
282 307
             video.fadeOut(300, changeVideo.bind(video, this.isLargeVideoVisible()));
283 308
         } else {
284
-            var jid = null;
285
-            if(currentSmallVideo)
286
-                jid = currentSmallVideo.peerJid;
287
-            Avatar.showUserAvatar(jid);
309
+            if(currentSmallVideo) {
310
+                currentSmallVideo.showAvatar();
311
+            }
288 312
         }
289 313
 
290 314
     },
@@ -411,7 +435,22 @@ var LargeVideo = {
411 435
     getResourceJid: function () {
412 436
         if(!currentSmallVideo)
413 437
             return null;
414
-        return currentSmallVideo.peerJid;
438
+        return currentSmallVideo.resourceJid;
439
+    },
440
+    updateAvatar: function (resourceJid) {
441
+        if (resourceJid === this.getResourceJid()) {
442
+            updateActiveSpeakerAvatarSrc();
443
+        }
444
+    },
445
+    showAvatar: function (resourceJid, show) {
446
+        if(this.getResourceJid() === resourceJid
447
+            && LargeVideo.isLargeVideoOnTop())
448
+        {
449
+            $("#largeVideo").css("visibility", show ? "hidden" : "visible");
450
+            $('#activeSpeaker').css("visibility", show ? "visible" : "hidden");
451
+            return true;
452
+        }
453
+        return false;
415 454
     }
416 455
 
417 456
 }

+ 1
- 1
modules/UI/videolayout/LocalVideo.js Dosyayı Görüntüle

@@ -215,7 +215,7 @@ LocalVideo.prototype.changeVideo = function (stream, isMuted) {
215 215
     // Add stream ended handler
216 216
     stream.getOriginalStream().onended = function () {
217 217
         localVideoContainer.removeChild(localVideo);
218
-        self.VideoLayout.updateRemovedVideo(APP.RTC.getVideoSrc(localVideo));
218
+        self.VideoLayout.updateRemovedVideo(APP.xmpp.myResource());
219 219
     };
220 220
 }
221 221
 

+ 4
- 5
modules/UI/videolayout/RemoteVideo.js Dosyayı Görüntüle

@@ -133,10 +133,8 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
133 133
         return false;
134 134
 
135 135
     var select = null;
136
-    var removedVideoSrc = null;
137 136
     if (isVideo) {
138 137
         select = $('#' + id);
139
-        removedVideoSrc = APP.RTC.getVideoSrc(select.get(0));
140 138
     }
141 139
     else
142 140
         select = $('#' + this.videoSpanId + '>audio');
@@ -160,8 +158,8 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
160 158
         this.VideoLayout.resizeThumbnails();
161 159
     }
162 160
 
163
-    if (removedVideoSrc)
164
-        this.VideoLayout.updateRemovedVideo(removedVideoSrc);
161
+    if (isVideo)
162
+        this.VideoLayout.updateRemovedVideo(this.resourceJid);
165 163
 };
166 164
 
167 165
 RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
@@ -270,7 +268,7 @@ RemoteVideo.prototype.showPeerContainer = function (state) {
270 268
             $(this.container).show();
271 269
         }
272 270
 
273
-        Avatar.showUserAvatar(this.peerJid, (state !== 'show'));
271
+        this.showAvatar(state !== 'show');
274 272
     }
275 273
     else if ($(this.container).is(':visible') && isHide)
276 274
     {
@@ -395,4 +393,5 @@ RemoteVideo.createContainer = function (spanId) {
395 393
     return remotes.appendChild(container);
396 394
 };
397 395
 
396
+
398 397
 module.exports = RemoteVideo;

+ 66
- 0
modules/UI/videolayout/SmallVideo.js Dosyayı Görüntüle

@@ -3,6 +3,13 @@ var LargeVideo = require("./LargeVideo");
3 3
 
4 4
 function SmallVideo(){
5 5
     this.isMuted = false;
6
+    this.hasAvatar = false;
7
+}
8
+
9
+function setVisibility(selector, show) {
10
+    if (selector && selector.length > 0) {
11
+        selector.css("visibility", show ? "visible" : "hidden");
12
+    }
6 13
 }
7 14
 
8 15
 SmallVideo.prototype.showDisplayName = function(isShow) {
@@ -149,6 +156,8 @@ SmallVideo.prototype.showAudioIndicator = function(isMuted) {
149 156
  * Shows video muted indicator over small videos.
150 157
  */
151 158
 SmallVideo.prototype.showVideoIndicator = function(isMuted) {
159
+    this.showAvatar(isMuted);
160
+
152 161
     var videoMutedSpan = $('#' + this.videoSpanId + '>span.videoMuted');
153 162
 
154 163
     if (isMuted === false) {
@@ -211,6 +220,8 @@ SmallVideo.prototype.enableDominantSpeaker = function (isEnable)
211 220
                 this.container.classList.remove("dominantspeaker");
212 221
         }
213 222
     }
223
+
224
+    this.showAvatar();
214 225
 };
215 226
 
216 227
 SmallVideo.prototype.updateIconPositions = function () {
@@ -282,4 +293,59 @@ SmallVideo.prototype.hasVideo = function () {
282 293
     return $("#" + this.videoSpanId).find("video").length !== 0;
283 294
 }
284 295
 
296
+/**
297
+ * Hides or shows the user's avatar
298
+ * @param show whether we should show the avatar or not
299
+ * video because there is no dominant speaker and no focused speaker
300
+ */
301
+SmallVideo.prototype.showAvatar = function (show) {
302
+    if(!this.hasAvatar)
303
+        return;
304
+
305
+    var video = $('#' + this.videoSpanId).find("video");
306
+    var avatar = $('#avatar_' + this.resourceJid);
307
+
308
+    if (show === undefined || show === null) {
309
+        if(!this.VideoLayout.isInLastN(this.resourceJid)) {
310
+            show = true;
311
+        }
312
+        else
313
+        {
314
+            show = APP.RTC.isVideoMuted(this.peerJid);
315
+        }
316
+
317
+    }
318
+
319
+    if (LargeVideo.showAvatar(this.resourceJid, show))
320
+    {
321
+        setVisibility(avatar, false);
322
+        setVisibility(video, false);
323
+    } else {
324
+        if (video && video.length > 0) {
325
+            setVisibility(video, !show);
326
+        }
327
+        setVisibility(avatar, show);
328
+
329
+    }
330
+}
331
+
332
+SmallVideo.prototype.avatarChanged = function (thumbUrl) {
333
+    var thumbnail = $('#' + this.videoSpanId);
334
+    var avatar = $('#avatar_' + this.resourceJid);
335
+    this.hasAvatar = true;
336
+
337
+    // set the avatar in the thumbnail
338
+    if (avatar && avatar.length > 0) {
339
+        avatar[0].src = thumbUrl;
340
+    } else {
341
+        if (thumbnail && thumbnail.length > 0) {
342
+            avatar = document.createElement('img');
343
+            avatar.id = 'avatar_' + this.resourceJid;
344
+            avatar.className = 'userAvatar';
345
+            avatar.src = thumbUrl;
346
+            thumbnail.append(avatar);
347
+        }
348
+    }
349
+}
350
+
285 351
 module.exports = SmallVideo;

+ 18
- 16
modules/UI/videolayout/VideoLayout.js Dosyayı Görüntüle

@@ -409,9 +409,6 @@ var VideoLayout = (function (my) {
409 409
             remoteVideos[resourceJid].enableDominantSpeaker(isEnable);
410 410
         }
411 411
 
412
-
413
-        Avatar.showUserAvatar(
414
-            APP.xmpp.findJidFromResource(resourceJid));
415 412
     };
416 413
 
417 414
     /**
@@ -516,7 +513,7 @@ var VideoLayout = (function (my) {
516 513
     /**
517 514
      * On audio muted event.
518 515
      */
519
-    $(document).bind('audiomuted.muc', function (event, jid, isMuted) {
516
+    my.onAudioMute = function (jid, isMuted) {
520 517
         var resourceJid = Strophe.getResourceFromJid(jid);
521 518
         if (resourceJid === APP.xmpp.myResource()) {
522 519
             localVideoThumbnail.showAudioIndicator(isMuted);
@@ -529,24 +526,22 @@ var VideoLayout = (function (my) {
529 526
         }
530 527
 
531 528
 
532
-    });
529
+    };
533 530
 
534 531
     /**
535 532
      * On video muted event.
536 533
      */
537
-    $(document).bind('videomuted.muc', function (event, jid, value) {
538
-        var isMuted = (value === "true");
539
-        if(jid !== APP.xmpp.myJid() && !APP.RTC.muteRemoteVideoStream(jid, isMuted))
534
+    my.onVideoMute = function (jid, value) {
535
+        if(jid !== APP.xmpp.myJid() && !APP.RTC.muteRemoteVideoStream(jid, value))
540 536
             return;
541 537
 
542
-        Avatar.showUserAvatar(jid, isMuted);
543 538
         if (jid === APP.xmpp.myJid()) {
544
-            localVideoThumbnail.showVideoIndicator(isMuted);
539
+            localVideoThumbnail.showVideoIndicator(value);
545 540
         } else {
546 541
             VideoLayout.ensurePeerContainerExists(jid);
547
-            remoteVideos[Strophe.getResourceFromJid(jid)].showVideoIndicator(isMuted);
542
+            remoteVideos[Strophe.getResourceFromJid(jid)].showVideoIndicator(value);
548 543
         }
549
-    });
544
+    };
550 545
 
551 546
     /**
552 547
      * Display name changed.
@@ -850,10 +845,8 @@ var VideoLayout = (function (my) {
850 845
             var smallVideo = VideoLayout.getSmallVideo(focusedVideoResourceJid);
851 846
             if(smallVideo)
852 847
                 smallVideo.focus(false);
853
-            Avatar.showUserAvatar(
854
-                APP.xmpp.findJidFromResource(focusedVideoResourceJid));
848
+            smallVideo.showAvatar();
855 849
             focusedVideoResourceJid = null;
856
-
857 850
         }
858 851
     }
859 852
 
@@ -879,7 +872,16 @@ var VideoLayout = (function (my) {
879 872
                 return null;
880 873
             return remoteVideos[resourceJid];
881 874
         }
882
-    }
875
+    };
876
+
877
+    my.userAvatarChanged = function(resourceJid, thumbUrl)
878
+    {
879
+        var smallVideo = VideoLayout.getSmallVideo(resourceJid);
880
+        if(smallVideo)
881
+            smallVideo.avatarChanged(thumbUrl);
882
+        LargeVideo.updateAvatar(resourceJid, thumbUrl);
883
+    };
884
+
883 885
     return my;
884 886
 }(VideoLayout || {}));
885 887
 

+ 6
- 2
modules/xmpp/strophe.emuc.js Dosyayı Görüntüle

@@ -143,13 +143,17 @@ module.exports = function(XMPP, eventEmitter) {
143 143
             // Parse audio info tag.
144 144
             var audioMuted = $(pres).find('>audiomuted');
145 145
             if (audioMuted.length) {
146
-                $(document).trigger('audiomuted.muc', [from, audioMuted.text()]);
146
+                eventEmitter.emit(XMPPEvents.AUDIO_MUTED,
147
+                    from, (audioMuted.text() === "true"));
148
+                $(document).trigger('audiomuted.muc', [from, ]);
147 149
             }
148 150
 
149 151
             // Parse video info tag.
150 152
             var videoMuted = $(pres).find('>videomuted');
151 153
             if (videoMuted.length) {
152
-                $(document).trigger('videomuted.muc', [from, videoMuted.text()]);
154
+                eventEmitter.emit(XMPPEvents.VIDEO_MUTED,
155
+                    from, (videoMuted.text() === "true"));
156
+                $(document).trigger('videomuted.muc', [from, ]);
153 157
             }
154 158
 
155 159
             var startMuted = $(pres).find('>startmuted');

+ 3
- 1
service/xmpp/XMPPEvents.js Dosyayı Görüntüle

@@ -31,6 +31,8 @@ var XMPPEvents = {
31 31
     DEVICE_AVAILABLE: "xmpp.device_available",
32 32
     START_MUTED: "xmpp.start_muted",
33 33
     PEERCONNECTION_READY: "xmpp.peerconnection_ready",
34
-    CONFERENCE_SETUP_FAILED: "xmpp.conference_setup_failed"
34
+    CONFERENCE_SETUP_FAILED: "xmpp.conference_setup_failed",
35
+    AUDIO_MUTED: "xmpp.audio_muted",
36
+    VIDEO_MUTED: "xmpp.video_muted"
35 37
 };
36 38
 module.exports = XMPPEvents;

Loading…
İptal
Kaydet