@reactoo/watchtogether-sdk-js 2.7.10 → 2.7.11

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.
@@ -9,7 +9,14 @@
9
9
  </head>
10
10
  <body>
11
11
  <div class="content">
12
+
13
+
14
+
15
+
16
+
12
17
  <video id="thevideo" class="contentVideo" autoplay playsinline controls style="width: 400px" muted="muted" src="https://assetcdn.reactoo.com/watfordFc/Norwich_2010_B_roll_2min16_mute.mp4"></video>
18
+ <video id="thevideo2" class="contentVideo" autoplay playsinline controls style="width: 400px" muted="muted" src="https://assetcdn.reactoo.com/watfordFc/Norwich_2010_B_roll_2min16_mute.mp4"></video>
19
+
13
20
  <div>
14
21
  <button onclick="startRoom()">Connect and publish</button>
15
22
  <button onclick="startRoom2()">Connect and publish with screen share</button>
@@ -30,6 +37,91 @@
30
37
 
31
38
  <script>
32
39
 
40
+
41
+ function videoProxy(videoElementCollection) {
42
+ const handler = {
43
+ get: (target, prop, receiver) => {
44
+ if(prop === 'setAttribute') {
45
+ return (attribute, value) => {
46
+ videoElementCollection.forEach((video) => {
47
+ video.setAttribute(attribute, value);
48
+ });
49
+ }
50
+ }
51
+
52
+ if(prop === 'removeAttribute') {
53
+ return (attribute) => {
54
+ videoElementCollection.forEach((video) => {
55
+ video.removeAttribute(attribute);
56
+ });
57
+ }
58
+ }
59
+
60
+ if(prop === 'load') {
61
+ return () => {
62
+ videoElementCollection.forEach((video) => {
63
+ video.load();
64
+ });
65
+ }
66
+ }
67
+
68
+ if(prop === 'play') {
69
+ return () => {
70
+ return Promise.all(videoElementCollection.map((video) => video.play()));
71
+ }
72
+ }
73
+
74
+ if(prop === 'pause') {
75
+ return () => {
76
+ videoElementCollection.forEach((video) => {
77
+ video.pause();
78
+ });
79
+ }
80
+ }
81
+ return Reflect.get(target, prop);
82
+ },
83
+ set: (target, prop, value, receiver) => {
84
+ if(prop === 'src') {
85
+ videoElementCollection.forEach((video) => {
86
+ video.src = value;
87
+ });
88
+ }
89
+
90
+ if(prop === 'srcObject') {
91
+ videoElementCollection.forEach((video) => {
92
+ video.srcObject = value;
93
+ });
94
+ }
95
+
96
+ if(prop === 'playbackRate') {
97
+ videoElementCollection.forEach((video) => {
98
+ video.playbackRate = value;
99
+ });
100
+ }
101
+
102
+ if(prop === 'currentTime') {
103
+ videoElementCollection.forEach((video) => {
104
+ video.currentTime = value;
105
+ });
106
+ }
107
+
108
+ if(prop === 'paused') {
109
+ videoElementCollection.forEach((video) => {
110
+ video.paused = value;
111
+ });
112
+ }
113
+
114
+ return target[prop] = value;
115
+
116
+ // return Reflect.set(target, prop, value);
117
+ }
118
+ };
119
+ return new Proxy(videoElementCollection[0], handler);
120
+ }
121
+
122
+ const cicka = videoProxy([document.getElementById('thevideo'), document.getElementById('thevideo2')]);
123
+
124
+
33
125
  //https://studio.reactoo.com/room/edf441b3-7415-49c4-9557-273cb93bc746/LJj4W2Cz-nG3U-lb0R-TAaY-o7Thmb8xHSbE
34
126
 
35
127
  let roomId = "c22ada04-6c95-4524-91d8-e915bcef2e61"; // It will create room automatically if not set
@@ -413,7 +505,7 @@
413
505
  });
414
506
 
415
507
  //attaching player
416
- session.attachPlayer('hlsnative-vod',{videoElement:window.thevideo});
508
+ // session.attachPlayer('hlsnative-vod',{videoElement:window.thevideo});
417
509
 
418
510
  })
419
511
  .catch(e => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.7.10",
3
+ "version": "2.7.11",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -44,6 +44,11 @@ let user = function () {
44
44
  .then(([client]) => client.apis.video.publishVideo({_id:id, roomId}, {requestBody:{_id:id, roomId, privateAttributes}}))
45
45
  },
46
46
 
47
+ publishVideo: (roomId, id, privateAttributes = {}) => {
48
+ return this.__privates.auth.__client
49
+ .then(client => client.apis.video.publishVideo({_id:id, roomId}, {requestBody:{_id:id, roomId, privateAttributes}}))
50
+ },
51
+
47
52
  getReactionById: (id) => {
48
53
  return this.__privates.auth.__client
49
54
  .then(client => client.apis.reaction.getReactionById({id}))