@stream-io/video-client 1.51.0 → 1.52.1-beta.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 +13 -0
- package/dist/index.browser.es.js +382 -18
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +382 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +382 -18
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +13 -1
- package/dist/src/gen/google/protobuf/struct.d.ts +3 -1
- package/dist/src/gen/google/protobuf/timestamp.d.ts +3 -1
- package/dist/src/gen/video/sfu/event/events.d.ts +26 -1
- package/dist/src/gen/video/sfu/models/models.d.ts +208 -2
- package/dist/src/gen/video/sfu/signal_rpc/signal.client.d.ts +31 -2
- package/dist/src/gen/video/sfu/signal_rpc/signal.d.ts +67 -1
- package/dist/src/helpers/participantUtils.d.ts +10 -0
- package/dist/src/rtc/BasePeerConnection.d.ts +1 -1
- package/dist/src/rtc/Publisher.d.ts +4 -1
- package/dist/src/rtc/Subscriber.d.ts +7 -0
- package/dist/src/rtc/types.d.ts +1 -0
- package/dist/src/stats/rtc/StatsTracer.d.ts +2 -1
- package/dist/src/stats/utils.d.ts +1 -0
- package/package.json +14 -14
- package/src/Call.ts +51 -2
- package/src/devices/__tests__/CameraManager.test.ts +3 -1
- package/src/devices/__tests__/DeviceManager.test.ts +3 -1
- package/src/devices/__tests__/MicrophoneManager.test.ts +3 -1
- package/src/devices/__tests__/MicrophoneManagerRN.test.ts +3 -1
- package/src/devices/__tests__/ScreenShareManager.test.ts +3 -1
- package/src/devices/__tests__/web-audio.mocks.ts +3 -1
- package/src/gen/google/protobuf/struct.ts +7 -12
- package/src/gen/google/protobuf/timestamp.ts +6 -7
- package/src/gen/video/sfu/event/events.ts +33 -25
- package/src/gen/video/sfu/models/models.ts +349 -1
- package/src/gen/video/sfu/signal_rpc/signal.client.ts +51 -29
- package/src/gen/video/sfu/signal_rpc/signal.ts +122 -15
- package/src/helpers/__tests__/DynascaleManager.test.ts +8 -7
- package/src/helpers/__tests__/browsers.test.ts +4 -4
- package/src/helpers/__tests__/participantUtils.test.ts +47 -0
- package/src/helpers/client-details.ts +4 -1
- package/src/helpers/participantUtils.ts +15 -0
- package/src/rtc/BasePeerConnection.ts +7 -1
- package/src/rtc/Publisher.ts +4 -0
- package/src/rtc/Subscriber.ts +29 -1
- package/src/rtc/__tests__/Subscriber.test.ts +5 -1
- package/src/rtc/__tests__/mocks/webrtc.mocks.ts +16 -15
- package/src/rtc/types.ts +1 -0
- package/src/stats/rtc/StatsTracer.ts +25 -4
- package/src/stats/rtc/__tests__/StatsTracer.test.ts +155 -0
package/src/Call.ts
CHANGED
|
@@ -321,6 +321,7 @@ export class Call {
|
|
|
321
321
|
private joinResponseTimeout?: number;
|
|
322
322
|
private rpcRequestTimeout?: number;
|
|
323
323
|
private joinCallData?: JoinCallData;
|
|
324
|
+
private selfSubEnabled = false;
|
|
324
325
|
private hasJoinedOnce = false;
|
|
325
326
|
private deviceSettingsAppliedOnce = false;
|
|
326
327
|
private credentials?: Credentials;
|
|
@@ -817,6 +818,37 @@ export class Call {
|
|
|
817
818
|
return this.clientStore.connectedUser?.id;
|
|
818
819
|
}
|
|
819
820
|
|
|
821
|
+
/**
|
|
822
|
+
* A flag indicating whether self-subscription is enabled for the call.
|
|
823
|
+
*/
|
|
824
|
+
get isSelfSubEnabled() {
|
|
825
|
+
return this.selfSubEnabled;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* The largest video publish dimension across the current publish options.
|
|
830
|
+
*
|
|
831
|
+
* @internal
|
|
832
|
+
*/
|
|
833
|
+
getMaxVideoPublishDimension = (): VideoDimension | undefined => {
|
|
834
|
+
if (!this.currentPublishOptions) return undefined;
|
|
835
|
+
let maxDimension: VideoDimension | undefined;
|
|
836
|
+
let maxArea = 0;
|
|
837
|
+
for (const opt of this.currentPublishOptions) {
|
|
838
|
+
if (opt.trackType !== TrackType.VIDEO) continue;
|
|
839
|
+
|
|
840
|
+
const dim = opt.videoDimension;
|
|
841
|
+
if (!dim || !dim.width || !dim.height) continue;
|
|
842
|
+
|
|
843
|
+
const area = dim.width * dim.height;
|
|
844
|
+
if (area > maxArea) {
|
|
845
|
+
maxDimension = dim;
|
|
846
|
+
maxArea = area;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return maxDimension;
|
|
850
|
+
};
|
|
851
|
+
|
|
820
852
|
/**
|
|
821
853
|
* A flag indicating whether the call was created by the current user.
|
|
822
854
|
*/
|
|
@@ -1029,11 +1061,13 @@ export class Call {
|
|
|
1029
1061
|
maxJoinRetries = 3,
|
|
1030
1062
|
joinResponseTimeout,
|
|
1031
1063
|
rpcRequestTimeout,
|
|
1064
|
+
selfSubEnabled = false,
|
|
1032
1065
|
...data
|
|
1033
1066
|
}: JoinCallData & {
|
|
1034
1067
|
maxJoinRetries?: number;
|
|
1035
1068
|
joinResponseTimeout?: number;
|
|
1036
1069
|
rpcRequestTimeout?: number;
|
|
1070
|
+
selfSubEnabled?: boolean;
|
|
1037
1071
|
} = {}): Promise<void> => {
|
|
1038
1072
|
const callingState = this.state.callingState;
|
|
1039
1073
|
|
|
@@ -1044,6 +1078,11 @@ export class Call {
|
|
|
1044
1078
|
if (data?.ring) {
|
|
1045
1079
|
this.ringingSubject.next(true);
|
|
1046
1080
|
}
|
|
1081
|
+
|
|
1082
|
+
// we need this to be set before the callingx.joinCall() is
|
|
1083
|
+
// called to avoid registering the test call in the CallKit/Telecom
|
|
1084
|
+
this.selfSubEnabled = selfSubEnabled;
|
|
1085
|
+
|
|
1047
1086
|
const callingX = globalThis.streamRNVideoSDK?.callingX;
|
|
1048
1087
|
if (callingX) {
|
|
1049
1088
|
// for Android/iOS, we need to start the call in the callingx library as soon as possible
|
|
@@ -1458,7 +1497,10 @@ export class Call {
|
|
|
1458
1497
|
closePreviousInstances,
|
|
1459
1498
|
unifiedSessionId,
|
|
1460
1499
|
} = opts;
|
|
1461
|
-
const {
|
|
1500
|
+
const {
|
|
1501
|
+
enable_rtc_stats: enableTracing,
|
|
1502
|
+
reporting_interval_ms: reportingIntervalMs,
|
|
1503
|
+
} = statsOptions;
|
|
1462
1504
|
if (closePreviousInstances && this.subscriber) {
|
|
1463
1505
|
await this.subscriber.dispose();
|
|
1464
1506
|
}
|
|
@@ -1469,6 +1511,7 @@ export class Call {
|
|
|
1469
1511
|
connectionConfig,
|
|
1470
1512
|
tag: sfuClient.tag,
|
|
1471
1513
|
enableTracing,
|
|
1514
|
+
statsTimestampDriftThresholdMs: reportingIntervalMs / 2,
|
|
1472
1515
|
clientPublishOptions: this.clientPublishOptions,
|
|
1473
1516
|
onReconnectionNeeded: (kind, reason, peerType) => {
|
|
1474
1517
|
this.reconnect(kind, reason).catch((err) => {
|
|
@@ -1493,7 +1536,13 @@ export class Call {
|
|
|
1493
1536
|
if (closePreviousInstances && this.publisher) {
|
|
1494
1537
|
await this.publisher.dispose();
|
|
1495
1538
|
}
|
|
1496
|
-
this.publisher = new Publisher(
|
|
1539
|
+
this.publisher = new Publisher(
|
|
1540
|
+
basePeerConnectionOptions,
|
|
1541
|
+
publishOptions,
|
|
1542
|
+
{
|
|
1543
|
+
selfSubEnabled: this.selfSubEnabled,
|
|
1544
|
+
},
|
|
1545
|
+
);
|
|
1497
1546
|
}
|
|
1498
1547
|
|
|
1499
1548
|
this.statsReporter?.stop();
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import type {
|
|
3
|
-
JsonObject,
|
|
4
|
-
JsonReadOptions,
|
|
5
|
-
JsonValue,
|
|
6
|
-
JsonWriteOptions,
|
|
7
|
-
} from '@protobuf-ts/runtime';
|
|
8
2
|
// @generated by protobuf-ts 2.10.0 with parameter long_type_string,client_generic,server_none,eslint_disable,optimize_code_size
|
|
9
3
|
// @generated from protobuf file "google/protobuf/struct.proto" (package "google.protobuf", syntax proto3)
|
|
10
4
|
// tslint:disable
|
|
@@ -39,12 +33,13 @@ import type {
|
|
|
39
33
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
40
34
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
41
35
|
//
|
|
42
|
-
import {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} from '@protobuf-ts/runtime';
|
|
47
|
-
|
|
36
|
+
import { isJsonObject } from '@protobuf-ts/runtime';
|
|
37
|
+
import { typeofJsonValue } from '@protobuf-ts/runtime';
|
|
38
|
+
import type { JsonValue } from '@protobuf-ts/runtime';
|
|
39
|
+
import type { JsonReadOptions } from '@protobuf-ts/runtime';
|
|
40
|
+
import type { JsonWriteOptions } from '@protobuf-ts/runtime';
|
|
41
|
+
import type { JsonObject } from '@protobuf-ts/runtime';
|
|
42
|
+
import { MessageType } from '@protobuf-ts/runtime';
|
|
48
43
|
/**
|
|
49
44
|
* `Struct` represents a structured data value, consisting of fields
|
|
50
45
|
* which map to dynamically typed values. In some languages, `Struct`
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import type {
|
|
3
|
-
JsonReadOptions,
|
|
4
|
-
JsonValue,
|
|
5
|
-
JsonWriteOptions,
|
|
6
|
-
} from '@protobuf-ts/runtime';
|
|
7
2
|
// @generated by protobuf-ts 2.10.0 with parameter long_type_string,client_generic,server_none,eslint_disable,optimize_code_size
|
|
8
3
|
// @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3)
|
|
9
4
|
// tslint:disable
|
|
@@ -38,8 +33,12 @@ import type {
|
|
|
38
33
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
39
34
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
40
35
|
//
|
|
41
|
-
import {
|
|
42
|
-
|
|
36
|
+
import { typeofJsonValue } from '@protobuf-ts/runtime';
|
|
37
|
+
import type { JsonValue } from '@protobuf-ts/runtime';
|
|
38
|
+
import type { JsonReadOptions } from '@protobuf-ts/runtime';
|
|
39
|
+
import type { JsonWriteOptions } from '@protobuf-ts/runtime';
|
|
40
|
+
import { PbLong } from '@protobuf-ts/runtime';
|
|
41
|
+
import { MessageType } from '@protobuf-ts/runtime';
|
|
43
42
|
/**
|
|
44
43
|
* A Timestamp represents a point in time independent of any time zone or local
|
|
45
44
|
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
@@ -1,33 +1,31 @@
|
|
|
1
|
+
|
|
1
2
|
// @generated by protobuf-ts 2.10.0 with parameter long_type_string,client_generic,server_none,eslint_disable,optimize_code_size
|
|
2
3
|
// @generated from protobuf file "video/sfu/event/events.proto" (package "stream.video.sfu.event", syntax proto3)
|
|
3
4
|
// tslint:disable
|
|
4
5
|
import { MessageType } from '@protobuf-ts/runtime';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ConnectionQuality,
|
|
13
|
-
DegradationPreference,
|
|
14
|
-
Error as Error$,
|
|
15
|
-
GoAwayReason,
|
|
16
|
-
ICETrickle as ICETrickle$,
|
|
17
|
-
Participant,
|
|
18
|
-
ParticipantCount,
|
|
19
|
-
ParticipantSource,
|
|
20
|
-
PeerType,
|
|
21
|
-
Pin,
|
|
22
|
-
PublishOption,
|
|
23
|
-
SubscribeOption,
|
|
24
|
-
TrackInfo,
|
|
25
|
-
TrackType,
|
|
26
|
-
TrackUnpublishReason,
|
|
27
|
-
WebsocketReconnectStrategy,
|
|
28
|
-
} from '../models/models';
|
|
6
|
+
import { CallEndedReason } from '../models/models';
|
|
7
|
+
import { GoAwayReason } from '../models/models';
|
|
8
|
+
import { CallGrants } from '../models/models';
|
|
9
|
+
import { DegradationPreference } from '../models/models';
|
|
10
|
+
import { Codec } from '../models/models';
|
|
11
|
+
import { ConnectionQuality } from '../models/models';
|
|
12
|
+
import { CallState } from '../models/models';
|
|
29
13
|
import { TrackSubscriptionDetails } from '../signal_rpc/signal';
|
|
30
|
-
|
|
14
|
+
import { TrackInfo } from '../models/models';
|
|
15
|
+
import { ParticipantSource } from '../models/models';
|
|
16
|
+
import { ClientCapability } from '../models/models';
|
|
17
|
+
import { SubscribeOption } from '../models/models';
|
|
18
|
+
import { ClientDetails } from '../models/models';
|
|
19
|
+
import { TrackUnpublishReason } from '../models/models';
|
|
20
|
+
import { Participant } from '../models/models';
|
|
21
|
+
import { TrackType } from '../models/models';
|
|
22
|
+
import { ParticipantCount } from '../models/models';
|
|
23
|
+
import { PeerType } from '../models/models';
|
|
24
|
+
import { WebsocketReconnectStrategy } from '../models/models';
|
|
25
|
+
import { Error as Error$ } from '../models/models';
|
|
26
|
+
import { Pin } from '../models/models';
|
|
27
|
+
import { PublishOption } from '../models/models';
|
|
28
|
+
import { ICETrickle as ICETrickle$ } from '../models/models';
|
|
31
29
|
/**
|
|
32
30
|
* SFUEvent is a message that is sent from the SFU to the client.
|
|
33
31
|
*
|
|
@@ -675,6 +673,10 @@ export interface SubscriberOffer {
|
|
|
675
673
|
* @generated from protobuf field: string sdp = 2;
|
|
676
674
|
*/
|
|
677
675
|
sdp: string;
|
|
676
|
+
/**
|
|
677
|
+
* @generated from protobuf field: uint32 negotiation_id = 3;
|
|
678
|
+
*/
|
|
679
|
+
negotiationId: number;
|
|
678
680
|
}
|
|
679
681
|
/**
|
|
680
682
|
* @generated from protobuf message stream.video.sfu.event.PublisherAnswer
|
|
@@ -1606,6 +1608,12 @@ class SubscriberOffer$Type extends MessageType<SubscriberOffer> {
|
|
|
1606
1608
|
super('stream.video.sfu.event.SubscriberOffer', [
|
|
1607
1609
|
{ no: 1, name: 'ice_restart', kind: 'scalar', T: 8 /*ScalarType.BOOL*/ },
|
|
1608
1610
|
{ no: 2, name: 'sdp', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
|
|
1611
|
+
{
|
|
1612
|
+
no: 3,
|
|
1613
|
+
name: 'negotiation_id',
|
|
1614
|
+
kind: 'scalar',
|
|
1615
|
+
T: 13 /*ScalarType.UINT32*/,
|
|
1616
|
+
},
|
|
1609
1617
|
]);
|
|
1610
1618
|
}
|
|
1611
1619
|
}
|