@stream-io/video-client 1.11.13 → 1.11.15
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 +44 -22
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +44 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +44 -22
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +6 -1
- package/dist/src/devices/BrowserPermission.d.ts +1 -1
- package/package.json +1 -1
- package/src/Call.ts +25 -0
- package/src/StreamVideoClient.ts +17 -19
- package/src/devices/BrowserPermission.ts +1 -1
- package/src/devices/devices.ts +1 -2
package/dist/index.es.js
CHANGED
|
@@ -3298,7 +3298,7 @@ const retryable = async (rpc, signal) => {
|
|
|
3298
3298
|
return result;
|
|
3299
3299
|
};
|
|
3300
3300
|
|
|
3301
|
-
const version = "1.11.
|
|
3301
|
+
const version = "1.11.15";
|
|
3302
3302
|
const [major, minor, patch] = version.split('.');
|
|
3303
3303
|
let sdkInfo = {
|
|
3304
3304
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -8313,7 +8313,7 @@ class BrowserPermission {
|
|
|
8313
8313
|
return this.state;
|
|
8314
8314
|
}
|
|
8315
8315
|
async prompt({ forcePrompt = false, throwOnNotAllowed = false, } = {}) {
|
|
8316
|
-
await withoutConcurrency(`permission-prompt-${this.permission.queryName}`, async () => {
|
|
8316
|
+
return await withoutConcurrency(`permission-prompt-${this.permission.queryName}`, async () => {
|
|
8317
8317
|
if ((await this.getState()) !== 'prompt' ||
|
|
8318
8318
|
(this.wasPrompted && !forcePrompt)) {
|
|
8319
8319
|
const isGranted = this.state === 'granted';
|
|
@@ -8388,8 +8388,7 @@ const getDevices = (permission, kind) => {
|
|
|
8388
8388
|
// for privacy reasons, most browsers don't give you device labels
|
|
8389
8389
|
// unless you have a corresponding camera or microphone permission
|
|
8390
8390
|
const shouldPromptForBrowserPermission = devices.some((device) => device.kind === kind && device.label === '');
|
|
8391
|
-
if (shouldPromptForBrowserPermission) {
|
|
8392
|
-
await permission.prompt({ throwOnNotAllowed: true });
|
|
8391
|
+
if (shouldPromptForBrowserPermission && (await permission.prompt())) {
|
|
8393
8392
|
devices = await navigator.mediaDevices.enumerateDevices();
|
|
8394
8393
|
}
|
|
8395
8394
|
return devices.filter((device) => device.kind === kind &&
|
|
@@ -10144,6 +10143,28 @@ class Call {
|
|
|
10144
10143
|
await Promise.all(stopOnLeavePromises);
|
|
10145
10144
|
});
|
|
10146
10145
|
};
|
|
10146
|
+
/**
|
|
10147
|
+
* Update from the call response from the "call.ring" event
|
|
10148
|
+
* @internal
|
|
10149
|
+
*/
|
|
10150
|
+
this.updateFromRingingEvent = async (event) => {
|
|
10151
|
+
await this.setup();
|
|
10152
|
+
// call.ring event excludes the call creator in the members list
|
|
10153
|
+
// as the creator does not get the ring event
|
|
10154
|
+
// so update the member list accordingly
|
|
10155
|
+
const creator = this.state.members.find((m) => m.user.id === event.call.created_by.id);
|
|
10156
|
+
if (!creator) {
|
|
10157
|
+
this.state.setMembers(event.members);
|
|
10158
|
+
}
|
|
10159
|
+
else {
|
|
10160
|
+
this.state.setMembers([creator, ...event.members]);
|
|
10161
|
+
}
|
|
10162
|
+
// update the call state with the latest event data
|
|
10163
|
+
this.state.updateFromCallResponse(event.call);
|
|
10164
|
+
this.ringingSubject.next(true);
|
|
10165
|
+
this.watching = true;
|
|
10166
|
+
await this.applyDeviceConfig(false);
|
|
10167
|
+
};
|
|
10147
10168
|
/**
|
|
10148
10169
|
* Loads the information about the call.
|
|
10149
10170
|
*
|
|
@@ -12774,7 +12795,7 @@ class StreamClient {
|
|
|
12774
12795
|
return await this.wsConnection.connect(this.defaultWSTimeout);
|
|
12775
12796
|
};
|
|
12776
12797
|
this.getUserAgent = () => {
|
|
12777
|
-
const version = "1.11.
|
|
12798
|
+
const version = "1.11.15";
|
|
12778
12799
|
return (this.userAgent ||
|
|
12779
12800
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
12780
12801
|
};
|
|
@@ -12967,24 +12988,25 @@ class StreamVideoClient {
|
|
|
12967
12988
|
this.logger('debug', 'Received `call.ring` sent by the current user so ignoring the event');
|
|
12968
12989
|
return;
|
|
12969
12990
|
}
|
|
12970
|
-
// The call might already be tracked by the client,
|
|
12971
12991
|
// if `call.created` was received before `call.ring`.
|
|
12972
|
-
//
|
|
12973
|
-
const
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
|
|
12981
|
-
|
|
12982
|
-
|
|
12983
|
-
|
|
12984
|
-
|
|
12985
|
-
|
|
12986
|
-
|
|
12987
|
-
|
|
12992
|
+
// the client already has the call instance and we just need to update the state
|
|
12993
|
+
const theCall = this.writeableStateStore.findCall(call.type, call.id);
|
|
12994
|
+
if (theCall) {
|
|
12995
|
+
await theCall.updateFromRingingEvent(event);
|
|
12996
|
+
}
|
|
12997
|
+
else {
|
|
12998
|
+
// if client doesn't have the call instance, create the instance and fetch the latest state
|
|
12999
|
+
// Note: related - we also have onRingingCall method to handle this case from push notifications
|
|
13000
|
+
const newCallInstance = new Call({
|
|
13001
|
+
streamClient: this.streamClient,
|
|
13002
|
+
type: call.type,
|
|
13003
|
+
id: call.id,
|
|
13004
|
+
members,
|
|
13005
|
+
clientStore: this.writeableStateStore,
|
|
13006
|
+
ringing: true,
|
|
13007
|
+
});
|
|
13008
|
+
await newCallInstance.get();
|
|
13009
|
+
}
|
|
12988
13010
|
}));
|
|
12989
13011
|
return connectUserResponse;
|
|
12990
13012
|
};
|