@reactoo/watchtogether-sdk-js 2.6.67 → 2.6.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/watchtogether-sdk.js +6 -6
  2. package/dist/watchtogether-sdk.min.js +2 -2
  3. package/example/bulk_join_room/bulk_join_room.html +30 -30
  4. package/example/bulk_join_room/bulk_join_room_2.css +6 -1
  5. package/example/bulk_join_room/bulk_join_room_2.html +304 -137
  6. package/example/bulk_join_room/sound_empty.mp3 +0 -0
  7. package/example/index.html +26 -14
  8. package/package.json +1 -1
  9. package/src/models/room-session.js +12 -5
  10. package/src/models/room.js +1 -0
  11. package/src/modules/wt-room.js +504 -51
  12. package/src/modules/wt-utils.js +29 -1
  13. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/1.gif +0 -0
  14. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/10.gif +0 -0
  15. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/11.gif +0 -0
  16. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/12.gif +0 -0
  17. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/13.gif +0 -0
  18. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/14.gif +0 -0
  19. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/15.gif +0 -0
  20. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/16.gif +0 -0
  21. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/17.gif +0 -0
  22. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/18.gif +0 -0
  23. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/19.gif +0 -0
  24. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/2.gif +0 -0
  25. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/20.gif +0 -0
  26. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/21.gif +0 -0
  27. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/22.gif +0 -0
  28. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/23.gif +0 -0
  29. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/24.gif +0 -0
  30. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/25.gif +0 -0
  31. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/26.gif +0 -0
  32. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/27.gif +0 -0
  33. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/28.gif +0 -0
  34. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/29.gif +0 -0
  35. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/3.gif +0 -0
  36. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/30.gif +0 -0
  37. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/31.gif +0 -0
  38. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/32.gif +0 -0
  39. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/4.gif +0 -0
  40. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/5.gif +0 -0
  41. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/6.gif +0 -0
  42. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/7.gif +0 -0
  43. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/8.gif +0 -0
  44. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/9.gif +0 -0
@@ -4,6 +4,22 @@ import {getFingerPrint} from "./wt-fingerprint";
4
4
 
5
5
  let wait = function(ms) { return new Promise(resolve => setTimeout(resolve, ms))};
6
6
 
7
+ let median = function(values) {
8
+
9
+ if(values.length ===0) return 0;
10
+
11
+ values.sort(function(a,b){
12
+ return a-b;
13
+ });
14
+
15
+ var half = Math.floor(values.length / 2);
16
+
17
+ if (values.length % 2)
18
+ return values[half];
19
+
20
+ return (values[half - 1] + values[half]) / 2.0;
21
+ }
22
+
7
23
 
8
24
  // const getFingerPrint = function(instanceType, salt) {
9
25
  //
@@ -101,5 +117,17 @@ const clearExactTimeout = function(timeout) {
101
117
  };
102
118
 
103
119
 
120
+ const maxJitter = (x) => {
121
+ // A function that returns a value between 0.3 and 0.5 depending on the input x
122
+ // The function is based on a logistic curve with parameters a, b, c, and d
123
+ // The parameters are chosen such that f(30) = 0.3 and f(2) = 0.5
124
+ let a = 0.2; // The maximum value of the function
125
+ let b = -0.1; // The growth rate of the function
126
+ let c = 16; // The inflection point of the function
127
+ let d = 0.3; // The minimum value of the function
128
+ return a / (1 + Math.exp(-b * (x - c))) + d; // Fixed the typo here
129
+ }
130
+
131
+
104
132
 
105
- export {wait, getBrowserFingerprint, generateUUID, decodeJanusDisplay, setExactTimeout, clearExactTimeout}
133
+ export {wait, getBrowserFingerprint, generateUUID, decodeJanusDisplay, setExactTimeout, clearExactTimeout, median, maxJitter}