Przeglądaj źródła

Focus indication for other participants. Issue #3.

j8
Yana Stamcheva 11 lat temu
rodzic
commit
cfc1ea86cc
1 zmienionych plików z 33 dodań i 8 usunięć
  1. 33
    8
      app.js

+ 33
- 8
app.js Wyświetl plik

217
         resizeThumbnails();
217
         resizeThumbnails();
218
 
218
 
219
         updateLargeVideo(videoelem.attr('src'), false, 1);
219
         updateLargeVideo(videoelem.attr('src'), false, 1);
220
+                 
221
+        showFocusIndicator();
220
     }
222
     }
221
 });
223
 });
222
 
224
 
290
         updateLockButton();
292
         updateLockButton();
291
     }
293
     }
292
 
294
 
293
-    showFocusIndicator();
294
-
295
     $(pres).find('>media[xmlns="http://estos.de/ns/mjs"]>source').each(function (idx, ssrc) {
295
     $(pres).find('>media[xmlns="http://estos.de/ns/mjs"]>source').each(function (idx, ssrc) {
296
         //console.log(jid, 'assoc ssrc', ssrc.getAttribute('type'), ssrc.getAttribute('ssrc'));
296
         //console.log(jid, 'assoc ssrc', ssrc.getAttribute('type'), ssrc.getAttribute('ssrc'));
297
         ssrc2jid[ssrc.getAttribute('ssrc')] = jid;
297
         ssrc2jid[ssrc.getAttribute('ssrc')] = jid;
709
 
709
 
710
 /*
710
 /*
711
  * Shows a visual indicator for the focus of the conference.
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
 function showFocusIndicator() {
715
 function showFocusIndicator() {
714
-    if (focus !== null) {
716
+    if (focus != null) {
715
         var localVideoToolbar = document.getElementById('localVideoToolbar');
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
+}

Ładowanie…
Anuluj
Zapisz