Alex Trofimov пре 10 месеци
родитељ
комит
ab47533f4e

+ 8 - 1
modules/boonex/stream/classes/BxStrmEngineOvenMediaEngine.php

@@ -27,7 +27,14 @@ class BxStrmEngineOvenMediaEngine extends BxDol
         if (!$a)
             return false;
 
-        return $a['totalConnections'];
+        if (isset($a['totalConnections'])) // old API
+            return $a['totalConnections'];
+
+        $i = 0;
+        foreach ($a['connections'] as $k => $v) {
+            $i += $v;
+        }
+        return $i;
     }
 
     public function getStreamStats($sStreamKey)

+ 3 - 3
modules/boonex/stream/template/stream_viewers.html

@@ -2,7 +2,7 @@
 <script>
     var fFunc = function () {
         let playerInstance = typeof(OvenPlayer) === 'undefined' ? false : OvenPlayer.getPlayerByContainerId("bx-stream-player-__suffix__");
-        if ((!playerInstance || 'playing' == playerInstance.getState()) && ('undefined' !== typeof(document.hidden) && !document.hidden)) {
+        if ((!playerInstance || 'playing' == playerInstance.getState() || 'idle' == playerInstance.getState()) && ('undefined' !== typeof(document.hidden) && !document.hidden)) {
             $.getJSON('__url__', function (oData) {
                 if ('undefined' !== typeof(oData.viewers)) {
                     $('#bx-stream-viewers-__suffix__').html(oData.viewers);
@@ -15,11 +15,11 @@
                     $('.bx-stream-badge').hide();
                 }
             }).always(function() {
-                setTimeout(fFunc, 10000);
+                setTimeout(fFunc, 3000);
             });
         }
         else {
-            setTimeout(fFunc, 10000);
+            setTimeout(fFunc, 3000);
         }
     }
     fFunc();