Forráskód Böngészése

Common: Make call clock functional

Vijayakrishnan 5 éve
szülő
commit
8c9f00bd27
1 módosított fájl, 21 hozzáadás és 1 törlés
  1. 21 1
      resources/views/meeting.blade.php

+ 21 - 1
resources/views/meeting.blade.php

@@ -154,7 +154,6 @@
                     }
                 },
                 timeDisplay: function() {
-                    // this.time = new Date().getTime() - this.startTime;
                     var seconds = this.time / 1000,
                         minutes = parseInt(seconds / 60, 10);
                     seconds = parseInt(seconds % 60, 10);
@@ -221,6 +220,17 @@
                     pro.type = _data.hcpCategory;
                     pro.status = 'active';
 
+                    @if($guest)
+                        var self = this;
+                        if(!this.startTime) {
+                            this.startTime = new Date().getTime();
+                            window.setInterval(function() {
+                                self.time = new Date().getTime() - self.startTime;
+                            }, 1000);
+                            this.started = true;
+                        }
+                    @endif
+
                     // TODO: init pro stream
                 },
                 leaveCall: function() {
@@ -282,6 +292,16 @@
                         );
 
                         // WS subscriptions
+
+                        @if(!$guest)
+                        if(!self.startTime) {
+                            self.startTime = new Date().getTime();
+                            window.setInterval(function() {
+                                self.time = new Date().getTime() - self.startTime;
+                            }, 1000);
+                            self.started = true;
+                        }
+                        @endif
                     @endif
 
                     // TODO: init own stream