@stream-io/video-client 1.0.10 → 1.2.0
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 +5 -3
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +5 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +5 -3
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +4 -2
- package/dist/src/coordinator/connection/types.d.ts +2 -0
- package/package.json +2 -2
- package/src/Call.ts +9 -6
- package/src/coordinator/connection/types.ts +3 -0
- package/src/coordinator/connection/utils.ts +2 -2
- package/src/devices/CameraManagerState.ts +2 -2
- package/src/events/callEventHandlers.ts +1 -1
- package/src/rtc/Publisher.ts +13 -13
- package/src/stats/utils.ts +2 -2
package/dist/src/Call.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { VideoLayerSetting } from './gen/video/sfu/event/events';
|
|
|
7
7
|
import { DynascaleManager } from './helpers/DynascaleManager';
|
|
8
8
|
import { PermissionsContext } from './permissions';
|
|
9
9
|
import { StreamClient } from './coordinator/connection/client';
|
|
10
|
-
import { CallEventListener, Logger } from './coordinator/connection/types';
|
|
10
|
+
import { CallEventListener, Logger, RejectReason } from './coordinator/connection/types';
|
|
11
11
|
import { CameraManager, MicrophoneManager, ScreenShareManager, SpeakerManager } from './devices';
|
|
12
12
|
/**
|
|
13
13
|
* An object representation of a `Call`.
|
|
@@ -177,8 +177,10 @@ export declare class Call {
|
|
|
177
177
|
* This method should be used only for "ringing" call flows.
|
|
178
178
|
* {@link Call.leave} invokes this method automatically for you when you leave or reject this call.
|
|
179
179
|
* Unless you are implementing a custom "ringing" flow, you should not use this method.
|
|
180
|
+
*
|
|
181
|
+
* @param reason the reason for rejecting the call.
|
|
180
182
|
*/
|
|
181
|
-
reject: () => Promise<RejectCallResponse>;
|
|
183
|
+
reject: (reason?: RejectReason) => Promise<RejectCallResponse>;
|
|
182
184
|
/**
|
|
183
185
|
* Will start to watch for call related WebSocket events and initiate a call session with the server.
|
|
184
186
|
*
|
|
@@ -113,3 +113,5 @@ export type StreamClientOptions = Partial<AxiosRequestConfig> & {
|
|
|
113
113
|
};
|
|
114
114
|
export type TokenProvider = () => Promise<string>;
|
|
115
115
|
export type TokenOrProvider = null | string | TokenProvider | undefined;
|
|
116
|
+
export type BuiltInRejectReason = 'busy' | 'decline' | 'cancel';
|
|
117
|
+
export type RejectReason = BuiltInRejectReason | string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/video-client",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"packageManager": "yarn@3.2.4",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@vitest/coverage-v8": "^0.34.4",
|
|
53
53
|
"dotenv": "^16.3.1",
|
|
54
54
|
"happy-dom": "^11.0.2",
|
|
55
|
-
"prettier": "^
|
|
55
|
+
"prettier": "^3.3.0",
|
|
56
56
|
"rimraf": "^5.0.5",
|
|
57
57
|
"rollup": "^3.29.4",
|
|
58
58
|
"typescript": "^5.4.3",
|
package/src/Call.ts
CHANGED
|
@@ -119,6 +119,7 @@ import {
|
|
|
119
119
|
AllCallEvents,
|
|
120
120
|
CallEventListener,
|
|
121
121
|
Logger,
|
|
122
|
+
RejectReason,
|
|
122
123
|
StreamCallEvent,
|
|
123
124
|
} from './coordinator/connection/types';
|
|
124
125
|
import { getClientDetails } from './client-details';
|
|
@@ -680,10 +681,13 @@ export class Call {
|
|
|
680
681
|
* This method should be used only for "ringing" call flows.
|
|
681
682
|
* {@link Call.leave} invokes this method automatically for you when you leave or reject this call.
|
|
682
683
|
* Unless you are implementing a custom "ringing" flow, you should not use this method.
|
|
684
|
+
*
|
|
685
|
+
* @param reason the reason for rejecting the call.
|
|
683
686
|
*/
|
|
684
|
-
reject = async () => {
|
|
687
|
+
reject = async (reason?: RejectReason): Promise<RejectCallResponse> => {
|
|
685
688
|
return this.streamClient.post<RejectCallResponse>(
|
|
686
689
|
`${this.streamClientBasePath}/reject`,
|
|
690
|
+
{ reason: reason },
|
|
687
691
|
);
|
|
688
692
|
};
|
|
689
693
|
|
|
@@ -1392,8 +1396,8 @@ export class Call {
|
|
|
1392
1396
|
trackType === 'videoTrack'
|
|
1393
1397
|
? 'videoDimension'
|
|
1394
1398
|
: trackType === 'screenShareTrack'
|
|
1395
|
-
|
|
1396
|
-
|
|
1399
|
+
? 'screenShareDimension'
|
|
1400
|
+
: undefined;
|
|
1397
1401
|
if (prop) {
|
|
1398
1402
|
acc[sessionId] = {
|
|
1399
1403
|
[prop]: change.dimension,
|
|
@@ -1985,9 +1989,8 @@ export class Call {
|
|
|
1985
1989
|
);
|
|
1986
1990
|
}
|
|
1987
1991
|
|
|
1988
|
-
const { sdkName, sdkVersion, ...platform } =
|
|
1989
|
-
getClientDetails()
|
|
1990
|
-
);
|
|
1992
|
+
const { sdkName, sdkVersion, ...platform } =
|
|
1993
|
+
getSdkSignature(getClientDetails());
|
|
1991
1994
|
|
|
1992
1995
|
// user sessionId is not available once the call has been left
|
|
1993
1996
|
// until we relax the backend validation, we'll send N/A
|
|
@@ -142,3 +142,6 @@ export type StreamClientOptions = Partial<AxiosRequestConfig> & {
|
|
|
142
142
|
|
|
143
143
|
export type TokenProvider = () => Promise<string>;
|
|
144
144
|
export type TokenOrProvider = null | string | TokenProvider | undefined;
|
|
145
|
+
|
|
146
|
+
export type BuiltInRejectReason = 'busy' | 'decline' | 'cancel';
|
|
147
|
+
export type RejectReason = BuiltInRejectReason | string;
|
|
@@ -119,8 +119,8 @@ export function isOnline(logger: Logger) {
|
|
|
119
119
|
typeof navigator !== 'undefined'
|
|
120
120
|
? navigator
|
|
121
121
|
: typeof window !== 'undefined' && window.navigator
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
? window.navigator
|
|
123
|
+
: undefined;
|
|
124
124
|
|
|
125
125
|
if (!nav) {
|
|
126
126
|
logger(
|
|
@@ -55,8 +55,8 @@ export class CameraManagerState extends InputMediaDeviceManagerState {
|
|
|
55
55
|
const direction = isReactNative()
|
|
56
56
|
? this.direction
|
|
57
57
|
: stream.getVideoTracks()[0]?.getSettings().facingMode === 'environment'
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
? 'back'
|
|
59
|
+
: 'front';
|
|
60
60
|
this.setDirection(direction);
|
|
61
61
|
}
|
|
62
62
|
}
|
package/src/rtc/Publisher.ts
CHANGED
|
@@ -248,12 +248,12 @@ export class Publisher {
|
|
|
248
248
|
trackType === TrackType.VIDEO
|
|
249
249
|
? findOptimalVideoLayers(track, targetResolution)
|
|
250
250
|
: trackType === TrackType.SCREEN_SHARE
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
251
|
+
? findOptimalScreenSharingLayers(
|
|
252
|
+
track,
|
|
253
|
+
opts.screenShareSettings,
|
|
254
|
+
screenShareBitrate,
|
|
255
|
+
)
|
|
256
|
+
: undefined;
|
|
257
257
|
|
|
258
258
|
let preferredCodec = opts.preferredCodec;
|
|
259
259
|
if (!preferredCodec && trackType === TrackType.VIDEO) {
|
|
@@ -747,11 +747,11 @@ export class Publisher {
|
|
|
747
747
|
trackType === TrackType.VIDEO
|
|
748
748
|
? findOptimalVideoLayers(track, targetResolution)
|
|
749
749
|
: trackType === TrackType.SCREEN_SHARE
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
750
|
+
? findOptimalScreenSharingLayers(
|
|
751
|
+
track,
|
|
752
|
+
publishOpts?.screenShareSettings,
|
|
753
|
+
)
|
|
754
|
+
: [];
|
|
755
755
|
this.trackLayersCache[trackType] = optimalLayers;
|
|
756
756
|
} else {
|
|
757
757
|
// we report the last known optimal layers for ended tracks
|
|
@@ -853,7 +853,7 @@ export class Publisher {
|
|
|
853
853
|
return rid === 'q'
|
|
854
854
|
? VideoQuality.LOW_UNSPECIFIED
|
|
855
855
|
: rid === 'h'
|
|
856
|
-
|
|
857
|
-
|
|
856
|
+
? VideoQuality.MID
|
|
857
|
+
: VideoQuality.HIGH; // default to HIGH
|
|
858
858
|
};
|
|
859
859
|
}
|
package/src/stats/utils.ts
CHANGED
|
@@ -30,8 +30,8 @@ export const getSdkName = (sdk: Sdk | undefined) => {
|
|
|
30
30
|
return sdk && sdk.type === SdkType.REACT
|
|
31
31
|
? 'stream-react'
|
|
32
32
|
: sdk && sdk.type === SdkType.REACT_NATIVE
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
? 'stream-react-native'
|
|
34
|
+
: 'stream-js';
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
export const getSdkVersion = (sdk: Sdk | undefined) => {
|