@reactoo/watchtogether-sdk-js 2.6.82 → 2.6.83
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 +2 -2
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/bulk_join_room/README.md +24 -0
- package/example/bulk_join_room/bulk_join_room.html +29 -29
- package/example/bulk_join_room/persons_gifs_hq/1.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/10.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/11.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/12.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/13.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/14.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/15.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/16.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/17.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/2.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/3.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/4.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/5.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/6.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/7.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/8.mp4 +0 -0
- package/example/bulk_join_room/persons_gifs_hq/9.mp4 +0 -0
- package/package.json +1 -1
- package/src/modules/wt-room.js +5 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Bulk join script
|
|
2
|
+
|
|
3
|
+
## URL
|
|
4
|
+
The script is available at `<domain>/bulk_join_room/bulk_join_room.html`
|
|
5
|
+
|
|
6
|
+
## Script update
|
|
7
|
+
- Take the latest version of the bulk_join_room.html script from [picitujeromanov/WR-SDK](https://github.com/picitujeromanov/WR-SDK) project and copy it to this folder
|
|
8
|
+
- Include the persons_gifs folder too
|
|
9
|
+
- Build the SDK in SDK project and copy the result (content of dist folder including the min.js version) to the sdk-dist folder
|
|
10
|
+
- Update the bulk_join_room.html - set the route to the built sdk to `./sdk-dist/watchtogether-sdk.js`
|
|
11
|
+
- Do not make any other changes. It will be developed only in SDK project and copied here using these instructions
|
|
12
|
+
|
|
13
|
+
## Security
|
|
14
|
+
This script is publicly available and the is not name and password protected. This script is also available in SPM NPM package, so it already is publicly available
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
- Open the script - `<domain>/bulk_join_room/bulk_join_room.html`
|
|
18
|
+
- Set the Room ID
|
|
19
|
+
- Click `Create users and join room`
|
|
20
|
+
- Disconnect all participants using the `Leave`
|
|
21
|
+
- If you want to rejoin participants it is required to reload the page with the script
|
|
22
|
+
- You can also use other options like pin hash when required but
|
|
23
|
+
- Do not add more than 5 participants with less than 5000ms timeout between participants joints
|
|
24
|
+
- Do not add more than 32 participants (there are only 32 participants gifs available)
|
|
@@ -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) {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/src/modules/wt-room.js
CHANGED
|
@@ -1574,6 +1574,11 @@ class RoomSession {
|
|
|
1574
1574
|
mids.forEach(mid => {
|
|
1575
1575
|
|
|
1576
1576
|
const {source, simulcastBitrates} = p.webrtcStuff.tracksMap.find(t => t.mid === mid) || {};
|
|
1577
|
+
|
|
1578
|
+
if(!simulcastBitrates) {
|
|
1579
|
+
return;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1577
1582
|
const initialSubstreamBeenSet = !!p.webrtcStuff.initialSimulcastSubstreamBeenSet[mid];
|
|
1578
1583
|
const manualSelectedSubstream = p.webrtcStuff.simulcastSubstreamManualSelect?.[mid];
|
|
1579
1584
|
const defaultSelectedSubstream = typeof this.simulcastDefaultManualSubstream === 'object'
|
|
@@ -1624,7 +1629,6 @@ class RoomSession {
|
|
|
1624
1629
|
else if(simulcastMode === 'controlled') {
|
|
1625
1630
|
const currentSubstream = p.webrtcStuff.selectedSubstream[mid];
|
|
1626
1631
|
const settingsForCurrentSubstream = simulcastBitrates?.[simulcastBitrates.length - 1 - currentSubstream];
|
|
1627
|
-
console.log('test', simulcastBitrates, currentSubstream, settingsForCurrentSubstream)
|
|
1628
1632
|
let directionDecision = 0;
|
|
1629
1633
|
if(p.webrtcStuff?.stats?.[mid]?.length > this._upStatsLength) {
|
|
1630
1634
|
const upMedianStats = this._calculateMedianStats(p.webrtcStuff.stats[mid].slice(this._upStatsLength * -1));
|