@reactoo/watchtogether-sdk-js 2.5.10 → 2.5.14
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/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -41,9 +41,9 @@ function WatchTogether(modules = {}, instanceType, debug, playerFactory, provide
|
|
|
41
41
|
this.utils = utils;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
let watchTogether = function ({debug = true,
|
|
44
|
+
let watchTogether = function ({debug = true, language = 'en-GB', storagePrefix = "reactoo_", apiUrl = null} = {}) {
|
|
45
45
|
let room = new Room(debug);
|
|
46
|
-
let auth = new Auth(debug,
|
|
46
|
+
let auth = new Auth(debug, language, storagePrefix, apiUrl);
|
|
47
47
|
let iot = new Iot(debug);
|
|
48
48
|
|
|
49
49
|
return ({instanceType = 'reactooDemo', playerFactory = null, providerAuth = null} = {}) => {
|
|
@@ -132,7 +132,7 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
132
132
|
.then(() => this.connect({reactooRoomId}))
|
|
133
133
|
.then(() => {
|
|
134
134
|
if (isObserver) {
|
|
135
|
-
return this.publishLocal(null
|
|
135
|
+
return this.publishLocal(null);
|
|
136
136
|
} else if (stream) {
|
|
137
137
|
return this.publishLocal(stream);
|
|
138
138
|
} else
|
|
@@ -302,15 +302,8 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
302
302
|
});
|
|
303
303
|
},
|
|
304
304
|
|
|
305
|
-
publishLocal: function (stream = null, {
|
|
306
|
-
|
|
307
|
-
keepVideo = false,
|
|
308
|
-
getStreamIfEmpty = true,
|
|
309
|
-
askVideo = true
|
|
310
|
-
} = {}) {
|
|
311
|
-
return (stream || !getStreamIfEmpty
|
|
312
|
-
? room.publishLocal(stream, {keepAudio, keepVideo})
|
|
313
|
-
: wt.utils.getUserStream(askVideo).then(stream => room.publishLocal(stream)))
|
|
305
|
+
publishLocal: function (stream = null, {keepAudio = false, keepVideo = false} = {}) {
|
|
306
|
+
return room.publishLocal(stream, {keepAudio, keepVideo})
|
|
314
307
|
},
|
|
315
308
|
|
|
316
309
|
unpublishLocal: () => {
|
package/src/models/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
getUserStream(hasVideo, isHd, aDeviceId, vDeviceId, lfps, simpleConstraints) {
|
|
4
|
+
getUserStream(hasVideo, isHd, aDeviceId, vDeviceId, lfps, simpleConstraints, muteAudio = false, muteVideo = false) {
|
|
5
5
|
let fullConstraints, audioOnlyConstraints;
|
|
6
6
|
if(simpleConstraints) {
|
|
7
7
|
fullConstraints = {
|
|
@@ -41,5 +41,16 @@ export default {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return navigator.mediaDevices.getUserMedia(hasVideo ? fullConstraints : audioOnlyConstraints)
|
|
44
|
+
.then(stream => {
|
|
45
|
+
if (muteAudio) {
|
|
46
|
+
stream.getAudioTracks().forEach(track => track.enabled = false);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (muteVideo) {
|
|
50
|
+
stream.getVideoTracks().forEach(track => track.enabled = false);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return stream;
|
|
54
|
+
});
|
|
44
55
|
}
|
|
45
56
|
}
|
package/src/modules/wt-auth.js
CHANGED
|
@@ -4,7 +4,7 @@ import emitter from './wt-emitter';
|
|
|
4
4
|
|
|
5
5
|
class Auth {
|
|
6
6
|
|
|
7
|
-
constructor(enableDebugFlag,
|
|
7
|
+
constructor(enableDebugFlag, language = 'en-GB', storagePrefix = "", apiUrl = null) {
|
|
8
8
|
|
|
9
9
|
this.ID_TOKEN = `${storagePrefix !== "" ? storagePrefix+'_':''}rwt_idToken`;
|
|
10
10
|
this.ACCESS_TOKEN = `${storagePrefix !== "" ? storagePrefix+'_':''}rwt_accessToken`;
|
|
@@ -22,7 +22,7 @@ class Auth {
|
|
|
22
22
|
this.__isRefreshing = false;
|
|
23
23
|
this.__isLogged = null;
|
|
24
24
|
this.__parsedJwt = null;
|
|
25
|
-
this.__specUrl = apiUrl ? apiUrl :
|
|
25
|
+
this.__specUrl = apiUrl ? apiUrl : config.apiUrl;
|
|
26
26
|
this.__client = this.initialize(true);
|
|
27
27
|
}
|
|
28
28
|
|