@reactoo/watchtogether-sdk-js 2.5.83 → 2.5.85
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 +17 -17
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/index.html +16 -7
- package/package.json +1 -1
- package/src/models/room-session.js +10 -3
- package/src/modules/wt-room.js +297 -293
package/example/index.html
CHANGED
|
@@ -25,8 +25,10 @@
|
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
//https://studio.reactoo.com/room/edf441b3-7415-49c4-9557-273cb93bc746/LJj4W2Cz-nG3U-lb0R-TAaY-o7Thmb8xHSbE
|
|
29
|
+
|
|
30
|
+
let roomId = 'edf441b3-7415-49c4-9557-273cb93bc746'; //It will create room automatically if not set
|
|
31
|
+
let pinHash = 'LJj4W2Cz-nG3U-lb0R-TAaY-o7Thmb8xHSbE';//'967ca05f-7fab-a205-5913-39393bbbe923';
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
let participants = document.querySelector('.participants');
|
|
@@ -42,6 +44,10 @@
|
|
|
42
44
|
// });
|
|
43
45
|
// }
|
|
44
46
|
|
|
47
|
+
function selectSubStream(handleId, substream) {
|
|
48
|
+
Instance.room.getSessionByConstructId(constructId).selectSubStream(handleId, substream);
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
function hento() {
|
|
46
52
|
//Instance.system.getSettings();
|
|
47
53
|
Instance.system.getClient()
|
|
@@ -53,6 +59,8 @@
|
|
|
53
59
|
|
|
54
60
|
function createParticipant(data, isRemote = false) {
|
|
55
61
|
|
|
62
|
+
console.log('participantData', isRemote, data);
|
|
63
|
+
|
|
56
64
|
let id = `part_${data.id}`;
|
|
57
65
|
let el = document.querySelector(`.${id}`);
|
|
58
66
|
if(!el) {
|
|
@@ -94,9 +102,10 @@
|
|
|
94
102
|
Instance.room.getSessionByConstructId(constructId).unpublishLocal()
|
|
95
103
|
}
|
|
96
104
|
|
|
97
|
-
function publish() {
|
|
98
|
-
Instance.room.getSessionByConstructId(constructId)
|
|
99
|
-
|
|
105
|
+
function publish(vDeviceId) {
|
|
106
|
+
let sess = Instance.room.getSessionByConstructId(constructId);
|
|
107
|
+
Instance.utils.getUserStream({hasVideo:true, vDeviceId})
|
|
108
|
+
.then(stream => sess.publishLocal(stream))
|
|
100
109
|
}
|
|
101
110
|
|
|
102
111
|
function toggleVideo() {
|
|
@@ -198,11 +207,11 @@
|
|
|
198
207
|
});
|
|
199
208
|
|
|
200
209
|
session.$on('addRemoteParticipant', (participant) => {
|
|
201
|
-
createParticipant(participant); // remote stream is available (someone else published himself)
|
|
210
|
+
createParticipant(participant, true); // remote stream is available (someone else published himself)
|
|
202
211
|
});
|
|
203
212
|
|
|
204
213
|
session.$on('removeRemoteParticipant', (participant) => {
|
|
205
|
-
removeParticipant(participant); // remote stream is gone
|
|
214
|
+
removeParticipant(participant, true); // remote stream is gone
|
|
206
215
|
});
|
|
207
216
|
|
|
208
217
|
session.$on('userUpdate', (userId) => {
|
package/package.json
CHANGED
|
@@ -111,7 +111,10 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
|
|
|
111
111
|
roomData.data.userId,
|
|
112
112
|
roomData.data.webrtcVersion,
|
|
113
113
|
(roomData.data.bitrate ? parseInt(roomData.data.bitrate) : 0),
|
|
114
|
-
roomData.data.recordingFilename
|
|
114
|
+
roomData.data.recordingFilename,
|
|
115
|
+
roomData.data.simulcast,
|
|
116
|
+
roomData.data.simulcastBitrates || {}
|
|
117
|
+
)
|
|
115
118
|
})
|
|
116
119
|
.finally(() => {
|
|
117
120
|
emitter.emit('connecting', false);
|
|
@@ -312,8 +315,8 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
|
|
|
312
315
|
}
|
|
313
316
|
},
|
|
314
317
|
|
|
315
|
-
publishLocal: function (stream = null
|
|
316
|
-
return room.publishLocal(stream
|
|
318
|
+
publishLocal: function (stream = null) {
|
|
319
|
+
return room.publishLocal(stream)
|
|
317
320
|
},
|
|
318
321
|
|
|
319
322
|
unpublishLocal: () => {
|
|
@@ -328,6 +331,10 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
|
|
|
328
331
|
return room.toggleVideo();
|
|
329
332
|
},
|
|
330
333
|
|
|
334
|
+
selectSubStream: (handleId, substream) => {
|
|
335
|
+
return room.selectSubStream(handleId, substream);
|
|
336
|
+
},
|
|
337
|
+
|
|
331
338
|
setBitrateCap: (bitrate) => {
|
|
332
339
|
if(role === 'host') {
|
|
333
340
|
return;
|