@stream-io/video-client 0.0.4 → 0.0.6
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/CHANGELOG.md +14 -0
- package/dist/index.browser.es.js +46 -6
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +46 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +46 -6
- package/dist/index.es.js.map +1 -1
- package/dist/src/StreamVideoClient.d.ts +11 -0
- package/dist/src/coordinator/connection/client.d.ts +11 -0
- package/dist/src/events/recording.d.ts +3 -0
- package/dist/src/gen/coordinator/index.d.ts +68 -11
- package/package.json +1 -1
- package/src/StreamVideoClient.ts +19 -2
- package/src/coordinator/connection/client.ts +39 -1
- package/src/events/__tests__/recording.test.ts +14 -3
- package/src/events/recording.ts +15 -3
- package/src/gen/coordinator/index.ts +68 -11
package/dist/index.es.js
CHANGED
|
@@ -7546,14 +7546,17 @@ const watchCallBroadcastingStarted = (state) => {
|
|
|
7546
7546
|
return function onCallBroadcastingStarted(event) {
|
|
7547
7547
|
if (event.type !== 'call.broadcasting_started')
|
|
7548
7548
|
return;
|
|
7549
|
-
state.setMetadata((metadata) => (Object.assign(Object.assign({}, metadata), { broadcasting: true,
|
|
7549
|
+
state.setMetadata((metadata) => (Object.assign(Object.assign({}, metadata), { egress: Object.assign(Object.assign({}, metadata.egress), { broadcasting: true, hls: Object.assign(Object.assign({}, metadata.egress.hls), { playlist_url: event.hls_playlist_url }) }) })));
|
|
7550
7550
|
};
|
|
7551
7551
|
};
|
|
7552
|
+
/**
|
|
7553
|
+
* Watches for `call.broadcasting_stopped` events.
|
|
7554
|
+
*/
|
|
7552
7555
|
const watchCallBroadcastingStopped = (state) => {
|
|
7553
7556
|
return function onCallBroadcastingStopped(event) {
|
|
7554
7557
|
if (event.type !== 'call.broadcasting_stopped')
|
|
7555
7558
|
return;
|
|
7556
|
-
state.setMetadata((metadata) => (Object.assign(Object.assign({}, metadata), { broadcasting: false })));
|
|
7559
|
+
state.setMetadata((metadata) => (Object.assign(Object.assign({}, metadata), { egress: Object.assign(Object.assign({}, metadata.egress), { broadcasting: false }) })));
|
|
7557
7560
|
};
|
|
7558
7561
|
};
|
|
7559
7562
|
|
|
@@ -10994,7 +10997,7 @@ class StreamClient {
|
|
|
10994
10997
|
}
|
|
10995
10998
|
getUserAgent() {
|
|
10996
10999
|
return (this.userAgent ||
|
|
10997
|
-
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.
|
|
11000
|
+
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.5"}`);
|
|
10998
11001
|
}
|
|
10999
11002
|
setUserAgent(userAgent) {
|
|
11000
11003
|
this.userAgent = userAgent;
|
|
@@ -11028,6 +11031,32 @@ class StreamClient {
|
|
|
11028
11031
|
createAbortControllerForNextRequest() {
|
|
11029
11032
|
return (this.nextRequestAbortController = new AbortController());
|
|
11030
11033
|
}
|
|
11034
|
+
/**
|
|
11035
|
+
* createToken - Creates a token to authenticate this user. This function is used server side.
|
|
11036
|
+
* The resulting token should be passed to the client side when the users registers or logs in.
|
|
11037
|
+
*
|
|
11038
|
+
* @param {string} userID The User ID
|
|
11039
|
+
* @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
|
|
11040
|
+
* @param call_cids for anonymous tokens you have to provide the call cids the use can join
|
|
11041
|
+
*
|
|
11042
|
+
* @return {string} Returns a token
|
|
11043
|
+
*/
|
|
11044
|
+
createToken(userID, exp, iat, call_cids) {
|
|
11045
|
+
if (this.secret == null) {
|
|
11046
|
+
throw Error(`tokens can only be created server-side using the API Secret`);
|
|
11047
|
+
}
|
|
11048
|
+
const extra = {};
|
|
11049
|
+
if (exp) {
|
|
11050
|
+
extra.exp = exp;
|
|
11051
|
+
}
|
|
11052
|
+
if (iat) {
|
|
11053
|
+
extra.iat = iat;
|
|
11054
|
+
}
|
|
11055
|
+
if (call_cids) {
|
|
11056
|
+
extra.call_cids = call_cids;
|
|
11057
|
+
}
|
|
11058
|
+
return JWTUserToken(this.secret, userID, extra, {});
|
|
11059
|
+
}
|
|
11031
11060
|
}
|
|
11032
11061
|
|
|
11033
11062
|
/**
|
|
@@ -11265,9 +11294,7 @@ class StreamVideoClient {
|
|
|
11265
11294
|
this.removeDevice = (id, userID) => __awaiter(this, void 0, void 0, function* () {
|
|
11266
11295
|
return yield this.streamClient.delete('/devices', Object.assign({ id }, (userID ? { user_id: userID } : {})));
|
|
11267
11296
|
});
|
|
11268
|
-
this.streamClient = new StreamClient(apiKey, Object.assign({
|
|
11269
|
-
// FIXME: OL: fix SSR.
|
|
11270
|
-
browser: true, persistUserOnConnectionFailure: true }, opts));
|
|
11297
|
+
this.streamClient = new StreamClient(apiKey, Object.assign({ persistUserOnConnectionFailure: true }, opts));
|
|
11271
11298
|
this.writeableStateStore = new StreamVideoWriteableStateStore();
|
|
11272
11299
|
this.readOnlyStateStore = new StreamVideoReadOnlyStateStore(this.writeableStateStore);
|
|
11273
11300
|
}
|
|
@@ -11284,6 +11311,19 @@ class StreamVideoClient {
|
|
|
11284
11311
|
return yield this.addDevice(id, push_provider, push_provider_name, userID, true);
|
|
11285
11312
|
});
|
|
11286
11313
|
}
|
|
11314
|
+
/**
|
|
11315
|
+
* createToken - Creates a token to authenticate this user. This function is used server side.
|
|
11316
|
+
* The resulting token should be passed to the client side when the users registers or logs in.
|
|
11317
|
+
*
|
|
11318
|
+
* @param {string} userID The User ID
|
|
11319
|
+
* @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
|
|
11320
|
+
* @param call_cids for anonymous tokens you have to provide the call cids the use can join
|
|
11321
|
+
*
|
|
11322
|
+
* @return {string} Returns a token
|
|
11323
|
+
*/
|
|
11324
|
+
createToken(userID, exp, iat, call_cids) {
|
|
11325
|
+
return this.streamClient.createToken(userID, exp, iat, call_cids);
|
|
11326
|
+
}
|
|
11287
11327
|
}
|
|
11288
11328
|
|
|
11289
11329
|
const getDevices = (constraints) => {
|