Bladeren bron

Moves the method definition of the play callback.

master
damencho 9 jaren geleden
bovenliggende
commit
0370183e94
1 gewijzigde bestanden met toevoegingen van 22 en 22 verwijderingen
  1. 22
    22
      modules/RTC/JitsiRemoteTrack.js

+ 22
- 22
modules/RTC/JitsiRemoteTrack.js Bestand weergeven

97
     this.eventEmitter.emit(JitsiTrackEvents.TRACK_VIDEOTYPE_CHANGED, type);
97
     this.eventEmitter.emit(JitsiTrackEvents.TRACK_VIDEOTYPE_CHANGED, type);
98
 };
98
 };
99
 
99
 
100
+JitsiRemoteTrack.prototype._playCallback = function () {
101
+    var type = (this.isVideoTrack() ? 'video' : 'audio');
102
+
103
+    var now = window.performance.now();
104
+    console.log("(TIME) Render " + type + ":\t", now);
105
+    this.conference.getConnectionTimes()[type + ".render"] = now;
106
+
107
+    var ttfm = now
108
+        - (this.conference.getConnectionTimes()["session.initiate"]
109
+        - this.conference.getConnectionTimes()["muc.joined"])
110
+        - (window.connectionTimes["obtainPermissions.end"]
111
+        - window.connectionTimes["obtainPermissions.start"]);
112
+    this.conference.getConnectionTimes()[type + ".ttfm"] = ttfm;
113
+    console.log("(TIME) TTFM " + type + ":\t", ttfm);
114
+    var eventName = type +'.ttfm';
115
+    if(this.hasBeenMuted)
116
+        eventName += '.muted';
117
+    Statistics.analytics.sendEvent(eventName, ttfm);
118
+};
119
+
100
 /**
120
 /**
101
  * Attach time to first media tracker only if there is conference and only
121
  * Attach time to first media tracker only if there is conference and only
102
  * for the first element.
122
  * for the first element.
115
     if (this.isVideoTrack())
135
     if (this.isVideoTrack())
116
         ttfmTrackerVideoAttached = true;
136
         ttfmTrackerVideoAttached = true;
117
 
137
 
118
-    var playCallback = function () {
119
-        var type = (this.isVideoTrack() ? 'video' : 'audio');
120
-
121
-        var now = window.performance.now();
122
-        console.log("(TIME) Render " + type + ":\t", now);
123
-        this.conference.getConnectionTimes()[type + ".render"] = now;
124
-
125
-        var ttfm = now
126
-            - (this.conference.getConnectionTimes()["session.initiate"]
127
-                - this.conference.getConnectionTimes()["muc.joined"])
128
-            - (window.connectionTimes["obtainPermissions.end"]
129
-                - window.connectionTimes["obtainPermissions.start"]);
130
-        this.conference.getConnectionTimes()[type + ".ttfm"] = ttfm;
131
-        console.log("(TIME) TTFM " + type + ":\t", ttfm);
132
-        var eventName = type +'.ttfm';
133
-        if(this.hasBeenMuted)
134
-            eventName += '.muted';
135
-        Statistics.analytics.sendEvent(eventName, ttfm);
136
-    }.bind(this);
137
-
138
     if (RTCBrowserType.isTemasysPluginUsed()) {
138
     if (RTCBrowserType.isTemasysPluginUsed()) {
139
         // FIXME: this is not working for IE11
139
         // FIXME: this is not working for IE11
140
-        AdapterJS.addEvent(container, 'play', playCallback);
140
+        AdapterJS.addEvent(container, 'play', this._playCallback.bind(this));
141
     }
141
     }
142
     else {
142
     else {
143
-        container.addEventListener("canplay", playCallback);
143
+        container.addEventListener("canplay", this._playCallback.bind(this));
144
     }
144
     }
145
 };
145
 };
146
 
146
 

Laden…
Annuleren
Opslaan