|
@@ -4,6 +4,23 @@ import JitsiPopover from "../util/JitsiPopover";
|
4
|
4
|
import VideoLayout from "./VideoLayout";
|
5
|
5
|
import UIUtil from "../util/UIUtil";
|
6
|
6
|
|
|
7
|
+/**
|
|
8
|
+ * Maps a connection quality value (in percent) to the width of the "full" icon.
|
|
9
|
+ */
|
|
10
|
+const qualityToWidth = [
|
|
11
|
+ // Full (5 bars)
|
|
12
|
+ {percent: 80, width: "100%"},
|
|
13
|
+ // 4 bars
|
|
14
|
+ {percent: 60, width: "80%"},
|
|
15
|
+ // 3 bars
|
|
16
|
+ {percent: 40, width: "55%"},
|
|
17
|
+ // 2 bars
|
|
18
|
+ {percent: 20, width: "40%"},
|
|
19
|
+ // 1 bar
|
|
20
|
+ {percent: 0, width: "20%"}
|
|
21
|
+ // Note: we never show 0 bars.
|
|
22
|
+];
|
|
23
|
+
|
7
|
24
|
/**
|
8
|
25
|
* Constructs new connection indicator.
|
9
|
26
|
* @param videoContainer the video container associated with the indicator.
|
|
@@ -24,24 +41,6 @@ function ConnectionIndicator(videoContainer, videoId) {
|
24
|
41
|
this.create();
|
25
|
42
|
}
|
26
|
43
|
|
27
|
|
-/**
|
28
|
|
- * Values for the connection quality
|
29
|
|
- * @type {{98: string,
|
30
|
|
- * 81: string,
|
31
|
|
- * 64: string,
|
32
|
|
- * 47: string,
|
33
|
|
- * 30: string,
|
34
|
|
- * 0: string}}
|
35
|
|
- */
|
36
|
|
-ConnectionIndicator.connectionQualityValues = {
|
37
|
|
- 98: "100%", //full
|
38
|
|
- 81: "80%",//4 bars
|
39
|
|
- 64: "55%",//3 bars
|
40
|
|
- 47: "40%",//2 bars
|
41
|
|
- 30: "20%",//1 bar
|
42
|
|
- 0: "0"//empty
|
43
|
|
-};
|
44
|
|
-
|
45
|
44
|
ConnectionIndicator.getIP = function(value) {
|
46
|
45
|
return value.substring(0, value.lastIndexOf(":"));
|
47
|
46
|
};
|
|
@@ -360,12 +359,10 @@ ConnectionIndicator.prototype.updateConnectionQuality =
|
360
|
359
|
this.resolution = object.resolution;
|
361
|
360
|
}
|
362
|
361
|
}
|
363
|
|
- for (var quality in ConnectionIndicator.connectionQualityValues) {
|
364
|
|
- if (percent >= quality) {
|
365
|
|
- this.fullIcon.style.width =
|
366
|
|
- ConnectionIndicator.connectionQualityValues[quality];
|
367
|
|
- }
|
368
|
|
- }
|
|
362
|
+
|
|
363
|
+ let width = qualityToWidth.find(x => percent >= x.percent);
|
|
364
|
+ this.fullIcon.style.width = width.width;
|
|
365
|
+
|
369
|
366
|
if (object && typeof object.isResolutionHD === 'boolean') {
|
370
|
367
|
this.isResolutionHD = object.isResolutionHD;
|
371
|
368
|
}
|