@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.
- package/dist/watchtogether-sdk.js +6 -6
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/bulk_join_room/bulk_join_room.html +30 -30
- package/example/bulk_join_room/bulk_join_room_2.css +6 -1
- package/example/bulk_join_room/bulk_join_room_2.html +304 -137
- package/example/bulk_join_room/sound_empty.mp3 +0 -0
- package/example/index.html +26 -14
- package/package.json +1 -1
- package/src/models/room-session.js +12 -5
- package/src/models/room.js +1 -0
- package/src/modules/wt-room.js +504 -51
- package/src/modules/wt-utils.js +29 -1
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/1.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/10.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/11.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/12.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/13.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/14.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/15.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/16.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/17.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/18.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/19.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/2.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/20.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/21.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/22.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/23.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/24.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/25.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/26.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/27.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/28.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/29.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/3.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/30.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/31.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/32.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/4.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/5.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/6.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/7.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/8.gif +0 -0
- /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/9.gif +0 -0
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
|
|
53
53
|
let participantsCount = 3;
|
|
54
54
|
let instanceType = "reactooDemo";
|
|
55
|
-
let roomId = "
|
|
55
|
+
let roomId = "";
|
|
56
56
|
let pinHash = undefined;
|
|
57
57
|
let timeoutBetweenParticipantsJoins = 5000;
|
|
58
58
|
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
|
|
63
63
|
// This will generate array with length 32 and numbers from 0 to 31. Every number is unique
|
|
64
64
|
let randomGifOrder = Array(32).fill(0)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
.map((_, i) => i + 1)
|
|
66
|
+
.map((value) => ({ value, sort: Math.random() }))
|
|
67
|
+
.sort((a, b) => a.sort - b.sort)
|
|
68
|
+
.map(({ value }) => value);
|
|
69
69
|
|
|
70
70
|
function joinParticipants() {
|
|
71
71
|
participantsCount = parseInt(document.getElementById('users-count').value);
|
|
@@ -106,11 +106,11 @@
|
|
|
106
106
|
|
|
107
107
|
return participantsData.reduce((promiseChain, participantData) => {
|
|
108
108
|
return promiseChain.then(() => fetch(participantData.gifUrl))
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
.then(response => createGifDecoder(response.body, participantData))
|
|
110
|
+
.then(() => participantData.imageDecoder.decode({frameIndex: participantData.frameIndex}))
|
|
111
|
+
.then(decodeResult => renderImage(decodeResult, participantData))
|
|
112
|
+
.then(() => joinRoom(participantData))
|
|
113
|
+
.then(() => new Promise(resolve => setTimeout(resolve, timeoutBetweenParticipantsJoins)));
|
|
114
114
|
}, Promise.resolve());
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -167,30 +167,30 @@
|
|
|
167
167
|
|
|
168
168
|
// Decode the next frame ahead of display so it's ready in time.
|
|
169
169
|
participantData.imageDecoder.decode({frameIndex: participantData.frameIndex})
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
170
|
+
.then( nextDecodeResult => setTimeout(_ => {
|
|
171
|
+
renderImage(nextDecodeResult, participantData);
|
|
172
|
+
}, decodeResult.image.duration / 1000.0))
|
|
173
|
+
.catch(e => {
|
|
174
|
+
// We can end up requesting an imageIndex past the end since we're using
|
|
175
|
+
// a ReadableStrem from fetch(), when this happens just wrap around.
|
|
176
|
+
if (e instanceof RangeError) {
|
|
177
|
+
participantData.frameIndex = 0;
|
|
178
|
+
participantData.imageDecoder.decode({frameIndex: imageIndex}).then(decodeResult => renderImage(decodeResult, participantData));
|
|
179
|
+
} else {
|
|
180
|
+
throw e;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
function joinRoom(participantData) {
|
|
186
186
|
return participantData.sdkInstance.auth.deviceLogin(false, participantData.id)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
187
|
+
.then(() => participantData.sdkInstance.room.createSession({roomId, pinHash}))
|
|
188
|
+
.then(session => {
|
|
189
|
+
participantData.session = session;
|
|
190
|
+
return Promise.all([session, session.connect()])
|
|
191
|
+
})
|
|
192
|
+
.then(([session, _]) => session.publishLocal(participantData.canvas.captureStream(), 'camera0'))
|
|
193
|
+
.then(() => document.getElementById('joined-participants-count').value = ++joinedParticipantsCount);
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
function disconnectRoom(participantData) {
|
|
@@ -52,10 +52,15 @@
|
|
|
52
52
|
gap: 0;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.participant-container canvas
|
|
55
|
+
.participant-container canvas{
|
|
56
56
|
aspect-ratio: calc(16/9);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
.participant-container video{
|
|
60
|
+
max-width: 150px;
|
|
61
|
+
height: auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
59
64
|
.space {
|
|
60
65
|
height: 10px;
|
|
61
66
|
background-color: darkgrey;
|