@reactoo/watchtogether-sdk-js 2.4.34 → 2.4.41
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 +5 -5
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/index.html +2 -33
- package/package.json +1 -1
- package/src/models/room-session.js +0 -4
- package/src/models/room.js +12 -2
- package/src/models/user.js +5 -3
- package/src/modules/wt-room.js +10 -8
package/example/index.html
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
27
|
|
|
28
|
-
let roomId = '
|
|
28
|
+
let roomId = 'fc2d34f2-de58-42a0-9312-5cd40f2d754e'; //It will create room automatically if not set
|
|
29
29
|
let pinHash = undefined;//'967ca05f-7fab-a205-5913-39393bbbe923';
|
|
30
30
|
|
|
31
31
|
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
console.log('Iot message:', r);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
Instance.auth.
|
|
126
|
+
Instance.auth.deviceLogin() // login as browser
|
|
127
127
|
.then(r => Instance.iot.iotLogin()) // login to mqtt
|
|
128
128
|
.then(r => {
|
|
129
129
|
|
|
@@ -153,37 +153,6 @@
|
|
|
153
153
|
})
|
|
154
154
|
.then(r => Instance.room.createSession({roomId:r.roomId, pinHash: r.pinHash})) // pin hash is not needed if you're owner of the room
|
|
155
155
|
.then(session => {
|
|
156
|
-
Instance.user.getUserSelf().then(r => {
|
|
157
|
-
Instance.user.getIntegrationPublic('sportBuff',{
|
|
158
|
-
"operation": "auth",
|
|
159
|
-
uuid: r.data._id,
|
|
160
|
-
username: r.data.displayname
|
|
161
|
-
})
|
|
162
|
-
.then(r => console.log('wooo',r))
|
|
163
|
-
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
;
|
|
167
|
-
|
|
168
|
-
Instance.user.getVideos({type:'room', roomId, includeUserModels: true});
|
|
169
|
-
|
|
170
|
-
// Instance.user.getUserSelf().then(r => {
|
|
171
|
-
// console.log(r.data._id);
|
|
172
|
-
// return Instance.room.queue({roomId, operation:'join', userId:r.data._id});
|
|
173
|
-
// }).then(r => {
|
|
174
|
-
// console.log(r.data);
|
|
175
|
-
// return Instance.room.queue({roomId, operation:'status'});
|
|
176
|
-
// })
|
|
177
|
-
// .then(r => {
|
|
178
|
-
// console.log(r.data);
|
|
179
|
-
// return Instance.room.queue({roomId,userId:'eu-west-1:f3532bdd-cc3a-4c62-a77e-4f1f544d8fa9', operation:'approve'});
|
|
180
|
-
// })
|
|
181
|
-
// .then(r => {
|
|
182
|
-
// console.log(r.data);
|
|
183
|
-
// })
|
|
184
|
-
|
|
185
|
-
//
|
|
186
|
-
|
|
187
156
|
|
|
188
157
|
|
|
189
158
|
sessionHandler = session;
|
package/package.json
CHANGED
|
@@ -29,11 +29,7 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const emitter = _emitter_();
|
|
32
|
-
|
|
33
32
|
let alpTimeoutId = null;
|
|
34
|
-
let publishRetry = 0;
|
|
35
|
-
const maxPublishRetry = 3;
|
|
36
|
-
|
|
37
33
|
let ___; // return object
|
|
38
34
|
|
|
39
35
|
room.on('addLocalParticipant', () => {
|
package/src/models/room.js
CHANGED
|
@@ -159,6 +159,16 @@ let room = function () {
|
|
|
159
159
|
}))
|
|
160
160
|
},
|
|
161
161
|
|
|
162
|
+
getRoomChatList: ({roomId, type = "normal", size = 50, startKey = null} = {}) => {
|
|
163
|
+
let apiParams = {
|
|
164
|
+
roomId, type,
|
|
165
|
+
size,
|
|
166
|
+
...(startKey && {startKey})
|
|
167
|
+
};
|
|
168
|
+
return this.__privates.auth.__client
|
|
169
|
+
.then(client => client.apis.wt.getRoomChatList(apiParams))
|
|
170
|
+
},
|
|
171
|
+
|
|
162
172
|
getRoomsList: ({
|
|
163
173
|
type = 'participant',
|
|
164
174
|
activeOnly = null,
|
|
@@ -186,10 +196,10 @@ let room = function () {
|
|
|
186
196
|
|
|
187
197
|
},
|
|
188
198
|
|
|
189
|
-
setUser: ({userId, roomId, flag, timestamp, option}) => {
|
|
199
|
+
setUser: ({messageId, userId, roomId, flag, timestamp, option}) => {
|
|
190
200
|
//leave, kick, ban, unban, approve, report
|
|
191
201
|
return this.__privates.auth.__client
|
|
192
|
-
.then(client => client.apis.wt.setUser({userId, roomId, flag, timestamp, option}));
|
|
202
|
+
.then(client => client.apis.wt.setUser({messageId, userId, roomId, flag, timestamp, option}));
|
|
193
203
|
},
|
|
194
204
|
|
|
195
205
|
getRoomById: (id, pinHash = undefined, showPublic = undefined, demo = false) => {
|
package/src/models/user.js
CHANGED
|
@@ -111,16 +111,18 @@ let user = function () {
|
|
|
111
111
|
|
|
112
112
|
track: ({eventType = 'ERROR', message} = {}) => {
|
|
113
113
|
return this.__privates.auth.__client
|
|
114
|
-
.then(client => client.apis.wt.track({},{
|
|
114
|
+
.then(client => client.apis.wt.track({},{
|
|
115
|
+
requestBody:{
|
|
115
116
|
"eventType": eventType,
|
|
116
117
|
"appType": "web",
|
|
117
|
-
"deviceType": `desktop${navigator.maxTouchPoints ? '/
|
|
118
|
+
"deviceType": `desktop${navigator.maxTouchPoints ? '/touch' : ''}`,
|
|
118
119
|
"os": navigator.platform,
|
|
119
120
|
"browser": navigator.userAgent,
|
|
120
121
|
"domain": location.host,
|
|
121
122
|
"url": location.href,
|
|
122
123
|
"message": serializeError(message)
|
|
123
|
-
}
|
|
124
|
+
}
|
|
125
|
+
}));
|
|
124
126
|
},
|
|
125
127
|
|
|
126
128
|
getTranslation: ({namespace = 'wt'} = {}) => {
|
package/src/modules/wt-room.js
CHANGED
|
@@ -164,12 +164,7 @@ class RoomSession {
|
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
166
|
|
|
167
|
-
constructor(enableDebugFlag, type = 'reactooroom', options = {
|
|
168
|
-
classroomObserverSubscribeToInstructor: false,
|
|
169
|
-
classroomInstructorSubscribeToParticipants: false,
|
|
170
|
-
safariBugHotfixEnabled: true
|
|
171
|
-
}) {
|
|
172
|
-
|
|
167
|
+
constructor(enableDebugFlag, type = 'reactooroom', options = {}) {
|
|
173
168
|
this.server = null;
|
|
174
169
|
this.iceServers = null;
|
|
175
170
|
this.token = null;
|
|
@@ -182,7 +177,14 @@ class RoomSession {
|
|
|
182
177
|
this.isMonitor = false; // currently used just for classroom context so monitor user only subscribes to participants and not trainer (for other monitor this flag is not necessary)
|
|
183
178
|
this.recordingFilename = null;
|
|
184
179
|
this.pluginName = RoomSession.sessionTypes()[type];
|
|
185
|
-
this.options =
|
|
180
|
+
this.options = {
|
|
181
|
+
...{
|
|
182
|
+
classroomObserverSubscribeToInstructor: false,
|
|
183
|
+
classroomInstructorSubscribeToParticipants: false,
|
|
184
|
+
safariBugHotfixEnabled: adapter.browserDetails.browser === 'safari' && adapter.browserDetails.version < 605
|
|
185
|
+
},
|
|
186
|
+
options
|
|
187
|
+
};
|
|
186
188
|
//this.pluginName = this.#sessionTypes[type];
|
|
187
189
|
|
|
188
190
|
Object.assign(this, emitter());
|
|
@@ -2001,7 +2003,7 @@ class RoomSession {
|
|
|
2001
2003
|
}
|
|
2002
2004
|
let config = handle.webrtcStuff;
|
|
2003
2005
|
|
|
2004
|
-
if(this.options.safariBugHotfixEnabled
|
|
2006
|
+
if(this.options.safariBugHotfixEnabled) {
|
|
2005
2007
|
this.isVideoMuted = !this.isVideoMuted;
|
|
2006
2008
|
}
|
|
2007
2009
|
else if (this.isUnifiedPlan) {
|