Skip to content

Commit 7cad627

Browse files
authored
Merge branch 'main' into worker-timers
2 parents 0d49d44 + 1766c3e commit 7cad627

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1766
-942
lines changed

packages/client/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
44

5+
## [1.11.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.10.5...@stream-io/video-client-1.11.0) (2024-11-13)
6+
7+
8+
### Features
9+
10+
* Connection timing ([#1574](https://github.com/GetStream/stream-video-js/issues/1574)) ([ce1dc9a](https://github.com/GetStream/stream-video-js/commit/ce1dc9a01fc5b0e60e3dac6653c27e99fd4b3ecb))
11+
512
## [1.10.5](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.10.4...@stream-io/video-client-1.10.5) (2024-11-07)
613

714

packages/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stream-io/video-client",
3-
"version": "1.10.5",
3+
"version": "1.11.0",
44
"packageManager": "[email protected]",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.es.js",

packages/client/src/Call.ts

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ export class Call {
725725
* @returns a promise which resolves once the call join-flow has finished.
726726
*/
727727
join = async (data?: JoinCallData): Promise<void> => {
728+
const connectStartTime = Date.now();
728729
await this.setup();
729730
const callingState = this.state.callingState;
730731
if ([CallingState.JOINED, CallingState.JOINING].includes(callingState)) {
@@ -793,11 +794,11 @@ export class Call {
793794
: undefined;
794795
const { callState, fastReconnectDeadlineSeconds } = await sfuClient.join({
795796
subscriberSdp: receivingCapabilitiesSdp,
797+
publisherSdp: '',
796798
clientDetails,
797799
fastReconnect: performingFastReconnect,
798800
reconnectDetails,
799801
});
800-
801802
this.fastReconnectDeadlineSeconds = fastReconnectDeadlineSeconds;
802803
if (callState) {
803804
this.state.updateFromSfuCallState(
@@ -831,6 +832,16 @@ export class Call {
831832
});
832833
}
833834

835+
// make sure we only track connection timing if we are not calling this method as part of a reconnection flow
836+
if (!performingRejoin && !performingFastReconnect && !performingMigration) {
837+
this.sfuStatsReporter?.sendTelemetryData({
838+
data: {
839+
oneofKind: 'connectionTimeSeconds',
840+
connectionTimeSeconds: (Date.now() - connectStartTime) / 1000,
841+
},
842+
});
843+
}
844+
834845
if (performingRejoin) {
835846
const strategy = WebsocketReconnectStrategy[this.reconnectStrategy];
836847
await previousSfuClient?.leaveAndClose(
@@ -1130,28 +1141,49 @@ export class Call {
11301141
* @internal
11311142
*/
11321143
private reconnectFast = async () => {
1144+
let reconnectStartTime = Date.now();
11331145
this.reconnectStrategy = WebsocketReconnectStrategy.FAST;
11341146
this.state.setCallingState(CallingState.RECONNECTING);
1135-
return this.join(this.joinCallData);
1147+
await this.join(this.joinCallData);
1148+
this.sfuStatsReporter?.sendTelemetryData({
1149+
data: {
1150+
oneofKind: 'reconnection',
1151+
reconnection: {
1152+
timeSeconds: (Date.now() - reconnectStartTime) / 1000,
1153+
strategy: WebsocketReconnectStrategy.FAST,
1154+
},
1155+
},
1156+
});
11361157
};
11371158

11381159
/**
11391160
* Initiates the reconnection flow with the "rejoin" strategy.
11401161
* @internal
11411162
*/
11421163
private reconnectRejoin = async () => {
1164+
let reconnectStartTime = Date.now();
11431165
this.reconnectStrategy = WebsocketReconnectStrategy.REJOIN;
11441166
this.state.setCallingState(CallingState.RECONNECTING);
11451167
await this.join(this.joinCallData);
11461168
await this.restorePublishedTracks();
11471169
this.restoreSubscribedTracks();
1170+
this.sfuStatsReporter?.sendTelemetryData({
1171+
data: {
1172+
oneofKind: 'reconnection',
1173+
reconnection: {
1174+
timeSeconds: (Date.now() - reconnectStartTime) / 1000,
1175+
strategy: WebsocketReconnectStrategy.REJOIN,
1176+
},
1177+
},
1178+
});
11481179
};
11491180

11501181
/**
11511182
* Initiates the reconnection flow with the "migrate" strategy.
11521183
* @internal
11531184
*/
11541185
private reconnectMigrate = async () => {
1186+
let reconnectStartTime = Date.now();
11551187
const currentSfuClient = this.sfuClient;
11561188
if (!currentSfuClient) {
11571189
throw new Error('Cannot migrate without an active SFU client');
@@ -1196,6 +1228,15 @@ export class Call {
11961228
// and close the previous SFU client, without specifying close code
11971229
currentSfuClient.close();
11981230
}
1231+
this.sfuStatsReporter?.sendTelemetryData({
1232+
data: {
1233+
oneofKind: 'reconnection',
1234+
reconnection: {
1235+
timeSeconds: (Date.now() - reconnectStartTime) / 1000,
1236+
strategy: WebsocketReconnectStrategy.MIGRATE,
1237+
},
1238+
},
1239+
});
11991240
};
12001241

12011242
/**

packages/client/src/gen/google/protobuf/struct.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,13 @@
3333
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3434
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3535
//
36-
import type {
37-
JsonObject,
38-
JsonReadOptions,
39-
JsonValue,
40-
JsonWriteOptions,
41-
} from '@protobuf-ts/runtime';
42-
import {
43-
isJsonObject,
44-
MessageType,
45-
typeofJsonValue,
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';
4843
/**
4944
* `Struct` represents a structured data value, consisting of fields
5045
* which map to dynamically typed values. In some languages, `Struct`

packages/client/src/gen/google/protobuf/timestamp.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@
3333
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3434
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3535
//
36-
import type {
37-
JsonReadOptions,
38-
JsonValue,
39-
JsonWriteOptions,
40-
} from '@protobuf-ts/runtime';
41-
import { MessageType, PbLong, typeofJsonValue } from '@protobuf-ts/runtime';
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';
4342
/**
4443
* A Timestamp represents a point in time independent of any time zone or local
4544
* calendar, encoded as a count of seconds and fractions of seconds at

packages/client/src/gen/video/sfu/event/events.ts

Lines changed: 112 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,26 @@
33
// @generated from protobuf file "video/sfu/event/events.proto" (package "stream.video.sfu.event", syntax proto3)
44
// tslint:disable
55
import { MessageType } from '@protobuf-ts/runtime';
6-
import {
7-
CallEndedReason,
8-
CallGrants,
9-
CallState,
10-
ClientDetails,
11-
Codec,
12-
ConnectionQuality,
13-
Error as Error$,
14-
GoAwayReason,
15-
ICETrickle as ICETrickle$,
16-
Participant,
17-
ParticipantCount,
18-
PeerType,
19-
Pin,
20-
TrackInfo,
21-
TrackType,
22-
TrackUnpublishReason,
23-
WebsocketReconnectStrategy,
24-
} from '../models/models';
6+
import { CallEndedReason } from '../models/models';
7+
import { GoAwayReason } from '../models/models';
8+
import { CallGrants } from '../models/models';
9+
import { Codec } from '../models/models';
10+
import { ConnectionQuality } from '../models/models';
11+
import { PublishOptions } from '../models/models';
12+
import { CallState } from '../models/models';
2513
import { TrackSubscriptionDetails } from '../signal_rpc/signal';
26-
14+
import { TrackInfo } from '../models/models';
15+
import { ClientDetails } from '../models/models';
16+
import { TrackUnpublishReason } from '../models/models';
17+
import { Participant } from '../models/models';
18+
import { TrackType } from '../models/models';
19+
import { ParticipantCount } from '../models/models';
20+
import { PeerType } from '../models/models';
21+
import { WebsocketReconnectStrategy } from '../models/models';
22+
import { Error as Error$ } from '../models/models';
23+
import { Pin } from '../models/models';
24+
import { PublishOption } from '../models/models';
25+
import { ICETrickle as ICETrickle$ } from '../models/models';
2726
/**
2827
* SFUEvent is a message that is sent from the SFU to the client.
2928
*
@@ -245,10 +244,42 @@ export interface SfuEvent {
245244
*/
246245
participantMigrationComplete: ParticipantMigrationComplete;
247246
}
247+
| {
248+
oneofKind: 'codecNegotiationComplete';
249+
/**
250+
* CodecNegotiationComplete is sent to signal the completion of a codec negotiation.
251+
* SDKs can safely stop previous transceivers
252+
*
253+
* @generated from protobuf field: stream.video.sfu.event.CodecNegotiationComplete codec_negotiation_complete = 26;
254+
*/
255+
codecNegotiationComplete: CodecNegotiationComplete;
256+
}
257+
| {
258+
oneofKind: 'changePublishOptions';
259+
/**
260+
* ChangePublishOptions is sent to signal the change in publish options such as a new codec or simulcast layers
261+
*
262+
* @generated from protobuf field: stream.video.sfu.event.ChangePublishOptions change_publish_options = 27;
263+
*/
264+
changePublishOptions: ChangePublishOptions;
265+
}
248266
| {
249267
oneofKind: undefined;
250268
};
251269
}
270+
/**
271+
* @generated from protobuf message stream.video.sfu.event.ChangePublishOptions
272+
*/
273+
export interface ChangePublishOptions {
274+
/**
275+
* @generated from protobuf field: stream.video.sfu.models.PublishOption publish_option = 1;
276+
*/
277+
publishOption?: PublishOption;
278+
}
279+
/**
280+
* @generated from protobuf message stream.video.sfu.event.CodecNegotiationComplete
281+
*/
282+
export interface CodecNegotiationComplete {}
252283
/**
253284
* @generated from protobuf message stream.video.sfu.event.ParticipantMigrationComplete
254285
*/
@@ -439,6 +470,10 @@ export interface JoinRequest {
439470
* @generated from protobuf field: string subscriber_sdp = 3;
440471
*/
441472
subscriberSdp: string;
473+
/**
474+
* @generated from protobuf field: string publisher_sdp = 8;
475+
*/
476+
publisherSdp: string;
442477
/**
443478
* @generated from protobuf field: stream.video.sfu.models.ClientDetails client_details = 4;
444479
*/
@@ -534,6 +569,10 @@ export interface JoinResponse {
534569
* @generated from protobuf field: int32 fast_reconnect_deadline_seconds = 3;
535570
*/
536571
fastReconnectDeadlineSeconds: number;
572+
/**
573+
* @generated from protobuf field: stream.video.sfu.models.PublishOptions publish_options = 4;
574+
*/
575+
publishOptions?: PublishOptions;
537576
}
538577
/**
539578
* ParticipantJoined is fired when a user joins a call
@@ -961,6 +1000,20 @@ class SfuEvent$Type extends MessageType<SfuEvent> {
9611000
oneof: 'eventPayload',
9621001
T: () => ParticipantMigrationComplete,
9631002
},
1003+
{
1004+
no: 26,
1005+
name: 'codec_negotiation_complete',
1006+
kind: 'message',
1007+
oneof: 'eventPayload',
1008+
T: () => CodecNegotiationComplete,
1009+
},
1010+
{
1011+
no: 27,
1012+
name: 'change_publish_options',
1013+
kind: 'message',
1014+
oneof: 'eventPayload',
1015+
T: () => ChangePublishOptions,
1016+
},
9641017
]);
9651018
}
9661019
}
@@ -969,6 +1022,33 @@ class SfuEvent$Type extends MessageType<SfuEvent> {
9691022
*/
9701023
export const SfuEvent = new SfuEvent$Type();
9711024
// @generated message type with reflection information, may provide speed optimized methods
1025+
class ChangePublishOptions$Type extends MessageType<ChangePublishOptions> {
1026+
constructor() {
1027+
super('stream.video.sfu.event.ChangePublishOptions', [
1028+
{
1029+
no: 1,
1030+
name: 'publish_option',
1031+
kind: 'message',
1032+
T: () => PublishOption,
1033+
},
1034+
]);
1035+
}
1036+
}
1037+
/**
1038+
* @generated MessageType for protobuf message stream.video.sfu.event.ChangePublishOptions
1039+
*/
1040+
export const ChangePublishOptions = new ChangePublishOptions$Type();
1041+
// @generated message type with reflection information, may provide speed optimized methods
1042+
class CodecNegotiationComplete$Type extends MessageType<CodecNegotiationComplete> {
1043+
constructor() {
1044+
super('stream.video.sfu.event.CodecNegotiationComplete', []);
1045+
}
1046+
}
1047+
/**
1048+
* @generated MessageType for protobuf message stream.video.sfu.event.CodecNegotiationComplete
1049+
*/
1050+
export const CodecNegotiationComplete = new CodecNegotiationComplete$Type();
1051+
// @generated message type with reflection information, may provide speed optimized methods
9721052
class ParticipantMigrationComplete$Type extends MessageType<ParticipantMigrationComplete> {
9731053
constructor() {
9741054
super('stream.video.sfu.event.ParticipantMigrationComplete', []);
@@ -1201,6 +1281,12 @@ class JoinRequest$Type extends MessageType<JoinRequest> {
12011281
kind: 'scalar',
12021282
T: 9 /*ScalarType.STRING*/,
12031283
},
1284+
{
1285+
no: 8,
1286+
name: 'publisher_sdp',
1287+
kind: 'scalar',
1288+
T: 9 /*ScalarType.STRING*/,
1289+
},
12041290
{
12051291
no: 4,
12061292
name: 'client_details',
@@ -1323,6 +1409,12 @@ class JoinResponse$Type extends MessageType<JoinResponse> {
13231409
kind: 'scalar',
13241410
T: 5 /*ScalarType.INT32*/,
13251411
},
1412+
{
1413+
no: 4,
1414+
name: 'publish_options',
1415+
kind: 'message',
1416+
T: () => PublishOptions,
1417+
},
13261418
]);
13271419
}
13281420
}

0 commit comments

Comments
 (0)