|
@@ -2,6 +2,7 @@
|
2
|
2
|
/* jshint -W101 */
|
3
|
3
|
import Avatar from "../avatar/Avatar";
|
4
|
4
|
import UIUtil from "../util/UIUtil";
|
|
5
|
+import UIEvents from "../../../service/UI/UIEvents";
|
5
|
6
|
|
6
|
7
|
const RTCUIHelper = JitsiMeetJS.util.RTCUIHelper;
|
7
|
8
|
|
|
@@ -487,4 +488,37 @@ SmallVideo.prototype.getIndicatorSpan = function(id) {
|
487
|
488
|
return indicatorSpan;
|
488
|
489
|
};
|
489
|
490
|
|
|
491
|
+/**
|
|
492
|
+ * Adds a listener for onresize events for this video, which will monitor for
|
|
493
|
+ * resolution changes, will calculate the delay since the moment the listened
|
|
494
|
+ * is added, and will fire a RESOLUTION_CHANGED event.
|
|
495
|
+ */
|
|
496
|
+SmallVideo.prototype.waitForResolutionChange = function() {
|
|
497
|
+ let self = this;
|
|
498
|
+ let beforeChange = window.performance.now();
|
|
499
|
+ let videos = this.selectVideoElement();
|
|
500
|
+ if (!videos || !videos.length || videos.length <= 0)
|
|
501
|
+ return;
|
|
502
|
+ let video = videos[0];
|
|
503
|
+ let oldWidth = video.videoWidth;
|
|
504
|
+ let oldHeight = video.videoHeight;
|
|
505
|
+ video.onresize = (event) => {
|
|
506
|
+ if (video.videoWidth != oldWidth || video.videoHeight != oldHeight) {
|
|
507
|
+ // Only run once.
|
|
508
|
+ video.onresize = null;
|
|
509
|
+
|
|
510
|
+ let delay = window.performance.now() - beforeChange;
|
|
511
|
+ let emitter = self.VideoLayout.getEventEmitter();
|
|
512
|
+ if (emitter) {
|
|
513
|
+ emitter.emit(
|
|
514
|
+ UIEvents.RESOLUTION_CHANGED,
|
|
515
|
+ self.getId(),
|
|
516
|
+ oldWidth + "x" + oldHeight,
|
|
517
|
+ video.videoWidth + "x" + video.videoHeight,
|
|
518
|
+ delay);
|
|
519
|
+ }
|
|
520
|
+ }
|
|
521
|
+ };
|
|
522
|
+};
|
|
523
|
+
|
490
|
524
|
export default SmallVideo;
|