소스 검색

Focus indication for other participants. Issue #3.

j8
Yana Stamcheva 11 년 전
부모
커밋
cfc1ea86cc
1개의 변경된 파일33개의 추가작업 그리고 8개의 파일을 삭제
  1. 33
    8
      app.js

+ 33
- 8
app.js 파일 보기

@@ -217,6 +217,8 @@ $(document).bind('callactive.jingle', function (event, videoelem, sid) {
217 217
         resizeThumbnails();
218 218
 
219 219
         updateLargeVideo(videoelem.attr('src'), false, 1);
220
+                 
221
+        showFocusIndicator();
220 222
     }
221 223
 });
222 224
 
@@ -290,8 +292,6 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {
290 292
         updateLockButton();
291 293
     }
292 294
 
293
-    showFocusIndicator();
294
-
295 295
     $(pres).find('>media[xmlns="http://estos.de/ns/mjs"]>source').each(function (idx, ssrc) {
296 296
         //console.log(jid, 'assoc ssrc', ssrc.getAttribute('type'), ssrc.getAttribute('ssrc'));
297 297
         ssrc2jid[ssrc.getAttribute('ssrc')] = jid;
@@ -709,16 +709,41 @@ function closePageWarning() {
709 709
 
710 710
 /*
711 711
  * Shows a visual indicator for the focus of the conference.
712
+ * Currently if we're not the owner of the conference we obtain the focus
713
+ * from the connection.jingle.sessions.
712 714
  */
713 715
 function showFocusIndicator() {
714
-    if (focus !== null) {
716
+    if (focus != null) {
715 717
         var localVideoToolbar = document.getElementById('localVideoToolbar');
716 718
 
717
-        var focusIndicator = document.createElement('i');
718
-        focusIndicator.className = 'fa fa-star';
719
-        localVideoToolbar.appendChild(focusIndicator);
719
+        if (localVideoToolbar.childNodes.length === 0)
720
+        {
721
+            createFocusIndicatorElement(localVideoToolbar);
722
+        }
720 723
     }
721
-    else {
722
-//        console.log("FOCUS JID", connection.jingle.sessions[Object.keys(connection.jingle.sessions)].peerjid);
724
+    else if (Object.keys(connection.jingle.sessions).length > 0) {
725
+        // If we're only a participant the focus will be the only session we have.
726
+        var session = connection.jingle.sessions[Object.keys(connection.jingle.sessions)[0]];
727
+        var focusId = 'participant_' + Strophe.getResourceFromJid(session.peerjid);
728
+        var focusContainer = document.getElementById(focusId);
729
+        var indicatorSpan = $('#' + focusId + ' .focusindicator');
730
+
731
+        if (!indicatorSpan || indicatorSpan.length == 0) {
732
+            indicatorSpan = document.createElement('span');
733
+            indicatorSpan.className = 'focusindicator';
734
+            focusContainer.appendChild(indicatorSpan);
735
+            
736
+            createFocusIndicatorElement(indicatorSpan);
737
+        }
723 738
     }
724 739
 }
740
+
741
+/*
742
+ * Creates the element indicating the focus of the conference.
743
+ */
744
+function createFocusIndicatorElement(parentElement) {
745
+    var focusIndicator = document.createElement('i');
746
+    focusIndicator.className = 'fa fa-star';
747
+    focusIndicator.title = "The owner of this conference"
748
+    parentElement.appendChild(focusIndicator);
749
+}

Loading…
취소
저장