@stream-io/video-client 1.18.9 → 1.19.1
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 +16 -7
- package/dist/index.browser.es.js +2612 -2301
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +2612 -2300
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +2612 -2301
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +3 -0
- package/dist/src/StreamSfuClient.d.ts +9 -2
- package/dist/src/gen/coordinator/index.d.ts +266 -5
- package/dist/src/gen/google/protobuf/struct.d.ts +1 -3
- package/dist/src/gen/google/protobuf/timestamp.d.ts +1 -3
- package/dist/src/gen/video/sfu/event/events.d.ts +6 -0
- package/dist/src/gen/video/sfu/models/models.d.ts +46 -0
- package/dist/src/gen/video/sfu/signal_rpc/signal.d.ts +13 -1
- package/dist/src/rpc/createClient.d.ts +2 -0
- package/dist/src/rtc/BasePeerConnection.d.ts +10 -3
- package/dist/src/stats/index.d.ts +2 -0
- package/dist/src/stats/rtc/Tracer.d.ts +15 -0
- package/dist/src/stats/rtc/index.d.ts +2 -0
- package/dist/src/stats/rtc/mediaDevices.d.ts +2 -0
- package/dist/src/stats/rtc/pc.d.ts +2 -0
- package/dist/src/stats/rtc/types.d.ts +8 -0
- package/index.ts +4 -0
- package/package.json +1 -1
- package/src/Call.ts +54 -29
- package/src/StreamSfuClient.ts +22 -9
- package/src/devices/MicrophoneManager.ts +5 -2
- package/src/devices/__tests__/MicrophoneManager.test.ts +9 -6
- package/src/devices/__tests__/MicrophoneManagerRN.test.ts +9 -6
- package/src/gen/coordinator/index.ts +262 -5
- package/src/gen/google/protobuf/struct.ts +13 -8
- package/src/gen/google/protobuf/timestamp.ts +10 -8
- package/src/gen/video/sfu/event/events.ts +8 -1
- package/src/gen/video/sfu/models/models.ts +63 -1
- package/src/gen/video/sfu/signal_rpc/signal.client.ts +1 -1
- package/src/gen/video/sfu/signal_rpc/signal.ts +27 -1
- package/src/rpc/__tests__/createClient.test.ts +38 -0
- package/src/rpc/createClient.ts +30 -0
- package/src/rtc/BasePeerConnection.ts +22 -4
- package/src/rtc/Publisher.ts +3 -2
- package/src/rtc/Subscriber.ts +0 -2
- package/src/rtc/__tests__/Subscriber.test.ts +1 -0
- package/src/rtc/helpers/__tests__/rtcConfiguration.test.ts +1 -0
- package/src/rtc/helpers/rtcConfiguration.ts +1 -0
- package/src/stats/SfuStatsReporter.ts +36 -12
- package/src/stats/index.ts +2 -0
- package/src/stats/rtc/Tracer.ts +42 -0
- package/src/stats/rtc/index.ts +5 -0
- package/src/stats/rtc/mediaDevices.ts +42 -0
- package/src/stats/rtc/pc.ts +130 -0
- package/src/stats/rtc/types.ts +26 -0
- package/src/store/CallState.ts +10 -0
|
@@ -726,6 +726,178 @@ export interface CallEvent {
|
|
|
726
726
|
*/
|
|
727
727
|
type: string;
|
|
728
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* This event is sent when frame recording has failed
|
|
731
|
+
* @export
|
|
732
|
+
* @interface CallFrameRecordingFailedEvent
|
|
733
|
+
*/
|
|
734
|
+
export interface CallFrameRecordingFailedEvent {
|
|
735
|
+
/**
|
|
736
|
+
*
|
|
737
|
+
* @type {CallResponse}
|
|
738
|
+
* @memberof CallFrameRecordingFailedEvent
|
|
739
|
+
*/
|
|
740
|
+
call: CallResponse;
|
|
741
|
+
/**
|
|
742
|
+
*
|
|
743
|
+
* @type {string}
|
|
744
|
+
* @memberof CallFrameRecordingFailedEvent
|
|
745
|
+
*/
|
|
746
|
+
call_cid: string;
|
|
747
|
+
/**
|
|
748
|
+
*
|
|
749
|
+
* @type {string}
|
|
750
|
+
* @memberof CallFrameRecordingFailedEvent
|
|
751
|
+
*/
|
|
752
|
+
created_at: string;
|
|
753
|
+
/**
|
|
754
|
+
*
|
|
755
|
+
* @type {string}
|
|
756
|
+
* @memberof CallFrameRecordingFailedEvent
|
|
757
|
+
*/
|
|
758
|
+
egress_id: string;
|
|
759
|
+
/**
|
|
760
|
+
* The type of event: "call.frame_recording_failed" in this case
|
|
761
|
+
* @type {string}
|
|
762
|
+
* @memberof CallFrameRecordingFailedEvent
|
|
763
|
+
*/
|
|
764
|
+
type: string;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* This event is sent when a frame is captured from a call
|
|
768
|
+
* @export
|
|
769
|
+
* @interface CallFrameRecordingFrameReadyEvent
|
|
770
|
+
*/
|
|
771
|
+
export interface CallFrameRecordingFrameReadyEvent {
|
|
772
|
+
/**
|
|
773
|
+
*
|
|
774
|
+
* @type {string}
|
|
775
|
+
* @memberof CallFrameRecordingFrameReadyEvent
|
|
776
|
+
*/
|
|
777
|
+
call_cid: string;
|
|
778
|
+
/**
|
|
779
|
+
* The time the frame was captured
|
|
780
|
+
* @type {string}
|
|
781
|
+
* @memberof CallFrameRecordingFrameReadyEvent
|
|
782
|
+
*/
|
|
783
|
+
captured_at: string;
|
|
784
|
+
/**
|
|
785
|
+
*
|
|
786
|
+
* @type {string}
|
|
787
|
+
* @memberof CallFrameRecordingFrameReadyEvent
|
|
788
|
+
*/
|
|
789
|
+
created_at: string;
|
|
790
|
+
/**
|
|
791
|
+
*
|
|
792
|
+
* @type {string}
|
|
793
|
+
* @memberof CallFrameRecordingFrameReadyEvent
|
|
794
|
+
*/
|
|
795
|
+
egress_id: string;
|
|
796
|
+
/**
|
|
797
|
+
* Call session ID
|
|
798
|
+
* @type {string}
|
|
799
|
+
* @memberof CallFrameRecordingFrameReadyEvent
|
|
800
|
+
*/
|
|
801
|
+
session_id: string;
|
|
802
|
+
/**
|
|
803
|
+
* The type of the track frame was captured from (TRACK_TYPE_VIDEO|TRACK_TYPE_SCREEN_SHARE)
|
|
804
|
+
* @type {string}
|
|
805
|
+
* @memberof CallFrameRecordingFrameReadyEvent
|
|
806
|
+
*/
|
|
807
|
+
track_type: string;
|
|
808
|
+
/**
|
|
809
|
+
* The type of event: "call.frame_recording_ready" in this case
|
|
810
|
+
* @type {string}
|
|
811
|
+
* @memberof CallFrameRecordingFrameReadyEvent
|
|
812
|
+
*/
|
|
813
|
+
type: string;
|
|
814
|
+
/**
|
|
815
|
+
* The URL of the frame
|
|
816
|
+
* @type {string}
|
|
817
|
+
* @memberof CallFrameRecordingFrameReadyEvent
|
|
818
|
+
*/
|
|
819
|
+
url: string;
|
|
820
|
+
/**
|
|
821
|
+
* The users in the frame
|
|
822
|
+
* @type {{ [key: string]: UserResponse; }}
|
|
823
|
+
* @memberof CallFrameRecordingFrameReadyEvent
|
|
824
|
+
*/
|
|
825
|
+
users: { [key: string]: UserResponse };
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* This event is sent when frame recording has started
|
|
829
|
+
* @export
|
|
830
|
+
* @interface CallFrameRecordingStartedEvent
|
|
831
|
+
*/
|
|
832
|
+
export interface CallFrameRecordingStartedEvent {
|
|
833
|
+
/**
|
|
834
|
+
*
|
|
835
|
+
* @type {CallResponse}
|
|
836
|
+
* @memberof CallFrameRecordingStartedEvent
|
|
837
|
+
*/
|
|
838
|
+
call: CallResponse;
|
|
839
|
+
/**
|
|
840
|
+
*
|
|
841
|
+
* @type {string}
|
|
842
|
+
* @memberof CallFrameRecordingStartedEvent
|
|
843
|
+
*/
|
|
844
|
+
call_cid: string;
|
|
845
|
+
/**
|
|
846
|
+
*
|
|
847
|
+
* @type {string}
|
|
848
|
+
* @memberof CallFrameRecordingStartedEvent
|
|
849
|
+
*/
|
|
850
|
+
created_at: string;
|
|
851
|
+
/**
|
|
852
|
+
*
|
|
853
|
+
* @type {string}
|
|
854
|
+
* @memberof CallFrameRecordingStartedEvent
|
|
855
|
+
*/
|
|
856
|
+
egress_id: string;
|
|
857
|
+
/**
|
|
858
|
+
* The type of event: "call.frame_recording_started" in this case
|
|
859
|
+
* @type {string}
|
|
860
|
+
* @memberof CallFrameRecordingStartedEvent
|
|
861
|
+
*/
|
|
862
|
+
type: string;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* This event is sent when frame recording has stopped
|
|
866
|
+
* @export
|
|
867
|
+
* @interface CallFrameRecordingStoppedEvent
|
|
868
|
+
*/
|
|
869
|
+
export interface CallFrameRecordingStoppedEvent {
|
|
870
|
+
/**
|
|
871
|
+
*
|
|
872
|
+
* @type {CallResponse}
|
|
873
|
+
* @memberof CallFrameRecordingStoppedEvent
|
|
874
|
+
*/
|
|
875
|
+
call: CallResponse;
|
|
876
|
+
/**
|
|
877
|
+
*
|
|
878
|
+
* @type {string}
|
|
879
|
+
* @memberof CallFrameRecordingStoppedEvent
|
|
880
|
+
*/
|
|
881
|
+
call_cid: string;
|
|
882
|
+
/**
|
|
883
|
+
*
|
|
884
|
+
* @type {string}
|
|
885
|
+
* @memberof CallFrameRecordingStoppedEvent
|
|
886
|
+
*/
|
|
887
|
+
created_at: string;
|
|
888
|
+
/**
|
|
889
|
+
*
|
|
890
|
+
* @type {string}
|
|
891
|
+
* @memberof CallFrameRecordingStoppedEvent
|
|
892
|
+
*/
|
|
893
|
+
egress_id: string;
|
|
894
|
+
/**
|
|
895
|
+
* The type of event: "call.frame_recording_stopped" in this case
|
|
896
|
+
* @type {string}
|
|
897
|
+
* @memberof CallFrameRecordingStoppedEvent
|
|
898
|
+
*/
|
|
899
|
+
type: string;
|
|
900
|
+
}
|
|
729
901
|
/**
|
|
730
902
|
* This event is sent when HLS broadcasting has failed
|
|
731
903
|
* @export
|
|
@@ -1221,6 +1393,12 @@ export interface CallRecording {
|
|
|
1221
1393
|
* @memberof CallRecording
|
|
1222
1394
|
*/
|
|
1223
1395
|
filename: string;
|
|
1396
|
+
/**
|
|
1397
|
+
*
|
|
1398
|
+
* @type {string}
|
|
1399
|
+
* @memberof CallRecording
|
|
1400
|
+
*/
|
|
1401
|
+
session_id: string;
|
|
1224
1402
|
/**
|
|
1225
1403
|
*
|
|
1226
1404
|
* @type {string}
|
|
@@ -1389,7 +1567,7 @@ export interface CallRejectedEvent {
|
|
|
1389
1567
|
*/
|
|
1390
1568
|
created_at: string;
|
|
1391
1569
|
/**
|
|
1392
|
-
*
|
|
1570
|
+
* Provides information about why the call was rejected. You can provide any value, but the Stream API and SDKs use these default values: rejected, cancel, timeout and busy
|
|
1393
1571
|
* @type {string}
|
|
1394
1572
|
* @memberof CallRejectedEvent
|
|
1395
1573
|
*/
|
|
@@ -3286,6 +3464,12 @@ export interface EgressResponse {
|
|
|
3286
3464
|
* @memberof EgressResponse
|
|
3287
3465
|
*/
|
|
3288
3466
|
broadcasting: boolean;
|
|
3467
|
+
/**
|
|
3468
|
+
*
|
|
3469
|
+
* @type {FrameRecordingResponse}
|
|
3470
|
+
* @memberof EgressResponse
|
|
3471
|
+
*/
|
|
3472
|
+
frame_recording?: FrameRecordingResponse;
|
|
3289
3473
|
/**
|
|
3290
3474
|
*
|
|
3291
3475
|
* @type {EgressHLSResponse}
|
|
@@ -3312,6 +3496,38 @@ export interface EndCallResponse {
|
|
|
3312
3496
|
*/
|
|
3313
3497
|
duration: string;
|
|
3314
3498
|
}
|
|
3499
|
+
/**
|
|
3500
|
+
*
|
|
3501
|
+
* @export
|
|
3502
|
+
* @interface FPSStats
|
|
3503
|
+
*/
|
|
3504
|
+
export interface FPSStats {
|
|
3505
|
+
/**
|
|
3506
|
+
*
|
|
3507
|
+
* @type {number}
|
|
3508
|
+
* @memberof FPSStats
|
|
3509
|
+
*/
|
|
3510
|
+
average_fps: number;
|
|
3511
|
+
/**
|
|
3512
|
+
*
|
|
3513
|
+
* @type {number}
|
|
3514
|
+
* @memberof FPSStats
|
|
3515
|
+
*/
|
|
3516
|
+
tracked: number;
|
|
3517
|
+
}
|
|
3518
|
+
/**
|
|
3519
|
+
*
|
|
3520
|
+
* @export
|
|
3521
|
+
* @interface FrameRecordingResponse
|
|
3522
|
+
*/
|
|
3523
|
+
export interface FrameRecordingResponse {
|
|
3524
|
+
/**
|
|
3525
|
+
*
|
|
3526
|
+
* @type {string}
|
|
3527
|
+
* @memberof FrameRecordingResponse
|
|
3528
|
+
*/
|
|
3529
|
+
status: string;
|
|
3530
|
+
}
|
|
3315
3531
|
/**
|
|
3316
3532
|
*
|
|
3317
3533
|
* @export
|
|
@@ -3335,7 +3551,7 @@ export interface FrameRecordingSettingsRequest {
|
|
|
3335
3551
|
* @type {string}
|
|
3336
3552
|
* @memberof FrameRecordingSettingsRequest
|
|
3337
3553
|
*/
|
|
3338
|
-
quality?:
|
|
3554
|
+
quality?: FrameRecordingSettingsRequestQualityEnum;
|
|
3339
3555
|
}
|
|
3340
3556
|
|
|
3341
3557
|
/**
|
|
@@ -3349,6 +3565,19 @@ export const FrameRecordingSettingsRequestModeEnum = {
|
|
|
3349
3565
|
export type FrameRecordingSettingsRequestModeEnum =
|
|
3350
3566
|
(typeof FrameRecordingSettingsRequestModeEnum)[keyof typeof FrameRecordingSettingsRequestModeEnum];
|
|
3351
3567
|
|
|
3568
|
+
/**
|
|
3569
|
+
* @export
|
|
3570
|
+
*/
|
|
3571
|
+
export const FrameRecordingSettingsRequestQualityEnum = {
|
|
3572
|
+
_360P: '360p',
|
|
3573
|
+
_480P: '480p',
|
|
3574
|
+
_720P: '720p',
|
|
3575
|
+
_1080P: '1080p',
|
|
3576
|
+
_1440P: '1440p',
|
|
3577
|
+
} as const;
|
|
3578
|
+
export type FrameRecordingSettingsRequestQualityEnum =
|
|
3579
|
+
(typeof FrameRecordingSettingsRequestQualityEnum)[keyof typeof FrameRecordingSettingsRequestQualityEnum];
|
|
3580
|
+
|
|
3352
3581
|
/**
|
|
3353
3582
|
*
|
|
3354
3583
|
* @export
|
|
@@ -3558,6 +3787,12 @@ export interface GetCallStatsResponse {
|
|
|
3558
3787
|
* @memberof GetCallStatsResponse
|
|
3559
3788
|
*/
|
|
3560
3789
|
duration: string;
|
|
3790
|
+
/**
|
|
3791
|
+
*
|
|
3792
|
+
* @type {boolean}
|
|
3793
|
+
* @memberof GetCallStatsResponse
|
|
3794
|
+
*/
|
|
3795
|
+
is_truncated_report: boolean;
|
|
3561
3796
|
/**
|
|
3562
3797
|
*
|
|
3563
3798
|
* @type {TimeStats}
|
|
@@ -5381,19 +5616,19 @@ export interface Response {
|
|
|
5381
5616
|
*/
|
|
5382
5617
|
export interface RingSettingsRequest {
|
|
5383
5618
|
/**
|
|
5384
|
-
*
|
|
5619
|
+
* When none of the callees accept a ring call in this time a rejection will be sent by the caller with reason 'timeout' by the SDKs
|
|
5385
5620
|
* @type {number}
|
|
5386
5621
|
* @memberof RingSettingsRequest
|
|
5387
5622
|
*/
|
|
5388
5623
|
auto_cancel_timeout_ms: number;
|
|
5389
5624
|
/**
|
|
5390
|
-
*
|
|
5625
|
+
* When a callee is online but doesn't answer a ring call in this time a rejection will be sent with reason 'timeout' by the SDKs
|
|
5391
5626
|
* @type {number}
|
|
5392
5627
|
* @memberof RingSettingsRequest
|
|
5393
5628
|
*/
|
|
5394
5629
|
incoming_call_timeout_ms: number;
|
|
5395
5630
|
/**
|
|
5396
|
-
*
|
|
5631
|
+
* When a callee doesn't accept or reject a ring call in this time a missed call event will be sent
|
|
5397
5632
|
* @type {number}
|
|
5398
5633
|
* @memberof RingSettingsRequest
|
|
5399
5634
|
*/
|
|
@@ -5850,6 +6085,12 @@ export interface StartTranscriptionResponse {
|
|
|
5850
6085
|
* @interface StatsOptions
|
|
5851
6086
|
*/
|
|
5852
6087
|
export interface StatsOptions {
|
|
6088
|
+
/**
|
|
6089
|
+
*
|
|
6090
|
+
* @type {boolean}
|
|
6091
|
+
* @memberof StatsOptions
|
|
6092
|
+
*/
|
|
6093
|
+
enable_rtc_stats: boolean;
|
|
5853
6094
|
/**
|
|
5854
6095
|
*
|
|
5855
6096
|
* @type {number}
|
|
@@ -6972,6 +7213,12 @@ export interface UserSessionStats {
|
|
|
6972
7213
|
* @memberof UserSessionStats
|
|
6973
7214
|
*/
|
|
6974
7215
|
distance_to_sfu_kilometers?: number;
|
|
7216
|
+
/**
|
|
7217
|
+
*
|
|
7218
|
+
* @type {FPSStats}
|
|
7219
|
+
* @memberof UserSessionStats
|
|
7220
|
+
*/
|
|
7221
|
+
fps?: FPSStats;
|
|
6975
7222
|
/**
|
|
6976
7223
|
*
|
|
6977
7224
|
* @type {number}
|
|
@@ -7245,6 +7492,12 @@ export interface UserSessionStats {
|
|
|
7245
7492
|
* @interface UserStats
|
|
7246
7493
|
*/
|
|
7247
7494
|
export interface UserStats {
|
|
7495
|
+
/**
|
|
7496
|
+
*
|
|
7497
|
+
* @type {string}
|
|
7498
|
+
* @memberof UserStats
|
|
7499
|
+
*/
|
|
7500
|
+
feedback?: string;
|
|
7248
7501
|
/**
|
|
7249
7502
|
*
|
|
7250
7503
|
* @type {UserInfoResponse}
|
|
@@ -7341,6 +7594,10 @@ export type VideoEvent =
|
|
|
7341
7594
|
| ({ type: 'call.created' } & CallCreatedEvent)
|
|
7342
7595
|
| ({ type: 'call.deleted' } & CallDeletedEvent)
|
|
7343
7596
|
| ({ type: 'call.ended' } & CallEndedEvent)
|
|
7597
|
+
| ({ type: 'call.frame_recording_failed' } & CallFrameRecordingFailedEvent)
|
|
7598
|
+
| ({ type: 'call.frame_recording_ready' } & CallFrameRecordingFrameReadyEvent)
|
|
7599
|
+
| ({ type: 'call.frame_recording_started' } & CallFrameRecordingStartedEvent)
|
|
7600
|
+
| ({ type: 'call.frame_recording_stopped' } & CallFrameRecordingStoppedEvent)
|
|
7344
7601
|
| ({ type: 'call.hls_broadcasting_failed' } & CallHLSBroadcastingFailedEvent)
|
|
7345
7602
|
| ({
|
|
7346
7603
|
type: 'call.hls_broadcasting_started';
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
|
|
2
|
+
import type {
|
|
3
|
+
JsonObject,
|
|
4
|
+
JsonReadOptions,
|
|
5
|
+
JsonValue,
|
|
6
|
+
JsonWriteOptions,
|
|
7
|
+
} from '@protobuf-ts/runtime';
|
|
8
|
+
// @generated by protobuf-ts 2.9.6 with parameter long_type_string,client_generic,server_none,eslint_disable,optimize_code_size
|
|
3
9
|
// @generated from protobuf file "google/protobuf/struct.proto" (package "google.protobuf", syntax proto3)
|
|
4
10
|
// tslint:disable
|
|
5
11
|
//
|
|
@@ -33,13 +39,12 @@
|
|
|
33
39
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
34
40
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
41
|
//
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
import { MessageType } from '@protobuf-ts/runtime';
|
|
42
|
+
import {
|
|
43
|
+
isJsonObject,
|
|
44
|
+
MessageType,
|
|
45
|
+
typeofJsonValue,
|
|
46
|
+
} from '@protobuf-ts/runtime';
|
|
47
|
+
|
|
43
48
|
/**
|
|
44
49
|
* `Struct` represents a structured data value, consisting of fields
|
|
45
50
|
* which map to dynamically typed values. In some languages, `Struct`
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
|
|
2
|
+
import type {
|
|
3
|
+
JsonReadOptions,
|
|
4
|
+
JsonValue,
|
|
5
|
+
JsonWriteOptions,
|
|
6
|
+
} from '@protobuf-ts/runtime';
|
|
7
|
+
// @generated by protobuf-ts 2.9.6 with parameter long_type_string,client_generic,server_none,eslint_disable,optimize_code_size
|
|
3
8
|
// @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3)
|
|
4
9
|
// tslint:disable
|
|
5
10
|
//
|
|
@@ -33,12 +38,8 @@
|
|
|
33
38
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
34
39
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
40
|
//
|
|
36
|
-
import { typeofJsonValue } from '@protobuf-ts/runtime';
|
|
37
|
-
|
|
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';
|
|
41
|
+
import { MessageType, PbLong, typeofJsonValue } from '@protobuf-ts/runtime';
|
|
42
|
+
|
|
42
43
|
/**
|
|
43
44
|
* A Timestamp represents a point in time independent of any time zone or local
|
|
44
45
|
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
@@ -189,7 +190,8 @@ class Timestamp$Type extends MessageType<Timestamp> {
|
|
|
189
190
|
const msg = this.create();
|
|
190
191
|
const ms = date.getTime();
|
|
191
192
|
msg.seconds = PbLong.from(Math.floor(ms / 1000)).toString();
|
|
192
|
-
msg.nanos =
|
|
193
|
+
msg.nanos =
|
|
194
|
+
((ms % 1000) + (ms < 0 && ms % 1000 !== 0 ? 1000 : 0)) * 1000000;
|
|
193
195
|
return msg;
|
|
194
196
|
}
|
|
195
197
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protobuf-ts 2.9.
|
|
1
|
+
// @generated by protobuf-ts 2.9.6 with parameter long_type_string,client_generic,server_none,eslint_disable,optimize_code_size
|
|
2
2
|
// @generated from protobuf file "video/sfu/event/events.proto" (package "stream.video.sfu.event", syntax proto3)
|
|
3
3
|
// tslint:disable
|
|
4
4
|
import { MessageType } from '@protobuf-ts/runtime';
|
|
@@ -539,6 +539,12 @@ export interface ReconnectDetails {
|
|
|
539
539
|
* @generated from protobuf field: string previous_session_id = 7;
|
|
540
540
|
*/
|
|
541
541
|
previousSessionId: string;
|
|
542
|
+
/**
|
|
543
|
+
* the reconnect reason
|
|
544
|
+
*
|
|
545
|
+
* @generated from protobuf field: string reason = 8;
|
|
546
|
+
*/
|
|
547
|
+
reason: string;
|
|
542
548
|
}
|
|
543
549
|
/**
|
|
544
550
|
* @generated from protobuf message stream.video.sfu.event.Migration
|
|
@@ -1389,6 +1395,7 @@ class ReconnectDetails$Type extends MessageType<ReconnectDetails> {
|
|
|
1389
1395
|
kind: 'scalar',
|
|
1390
1396
|
T: 9 /*ScalarType.STRING*/,
|
|
1391
1397
|
},
|
|
1398
|
+
{ no: 8, name: 'reason', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
|
|
1392
1399
|
]);
|
|
1393
1400
|
}
|
|
1394
1401
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protobuf-ts 2.9.
|
|
1
|
+
// @generated by protobuf-ts 2.9.6 with parameter long_type_string,client_generic,server_none,eslint_disable,optimize_code_size
|
|
2
2
|
// @generated from protobuf file "video/sfu/models/models.proto" (package "stream.video.sfu.models", syntax proto3)
|
|
3
3
|
// tslint:disable
|
|
4
4
|
import { MessageType } from '@protobuf-ts/runtime';
|
|
@@ -468,6 +468,45 @@ export interface Browser {
|
|
|
468
468
|
*/
|
|
469
469
|
version: string;
|
|
470
470
|
}
|
|
471
|
+
/**
|
|
472
|
+
* @generated from protobuf message stream.video.sfu.models.RTMPIngress
|
|
473
|
+
*/
|
|
474
|
+
export interface RTMPIngress {
|
|
475
|
+
/**
|
|
476
|
+
* Video dimensions and frame rate
|
|
477
|
+
*
|
|
478
|
+
* @generated from protobuf field: uint32 width = 1;
|
|
479
|
+
*/
|
|
480
|
+
width: number;
|
|
481
|
+
/**
|
|
482
|
+
* @generated from protobuf field: uint32 height = 2;
|
|
483
|
+
*/
|
|
484
|
+
height: number;
|
|
485
|
+
/**
|
|
486
|
+
* @generated from protobuf field: double frame_rate = 3;
|
|
487
|
+
*/
|
|
488
|
+
frameRate: number;
|
|
489
|
+
/**
|
|
490
|
+
* Client info
|
|
491
|
+
*
|
|
492
|
+
* @generated from protobuf field: string software = 4;
|
|
493
|
+
*/
|
|
494
|
+
software: string; // e.g. "obs-studio"
|
|
495
|
+
/**
|
|
496
|
+
* @generated from protobuf field: string version = 5;
|
|
497
|
+
*/
|
|
498
|
+
version: string; // e.g. "29.1.3"
|
|
499
|
+
/**
|
|
500
|
+
* @generated from protobuf field: string encoder = 6;
|
|
501
|
+
*/
|
|
502
|
+
encoder: string; // e.g. "x264" or "NVIDIA NVENC"
|
|
503
|
+
/**
|
|
504
|
+
* Connection info
|
|
505
|
+
*
|
|
506
|
+
* @generated from protobuf field: string remote_addr = 7;
|
|
507
|
+
*/
|
|
508
|
+
remoteAddr: string;
|
|
509
|
+
}
|
|
471
510
|
/**
|
|
472
511
|
* @generated from protobuf message stream.video.sfu.models.Device
|
|
473
512
|
*/
|
|
@@ -1426,6 +1465,29 @@ class Browser$Type extends MessageType<Browser> {
|
|
|
1426
1465
|
*/
|
|
1427
1466
|
export const Browser = new Browser$Type();
|
|
1428
1467
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
1468
|
+
class RTMPIngress$Type extends MessageType<RTMPIngress> {
|
|
1469
|
+
constructor() {
|
|
1470
|
+
super('stream.video.sfu.models.RTMPIngress', [
|
|
1471
|
+
{ no: 1, name: 'width', kind: 'scalar', T: 13 /*ScalarType.UINT32*/ },
|
|
1472
|
+
{ no: 2, name: 'height', kind: 'scalar', T: 13 /*ScalarType.UINT32*/ },
|
|
1473
|
+
{ no: 3, name: 'frame_rate', kind: 'scalar', T: 1 /*ScalarType.DOUBLE*/ },
|
|
1474
|
+
{ no: 4, name: 'software', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
|
|
1475
|
+
{ no: 5, name: 'version', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
|
|
1476
|
+
{ no: 6, name: 'encoder', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
|
|
1477
|
+
{
|
|
1478
|
+
no: 7,
|
|
1479
|
+
name: 'remote_addr',
|
|
1480
|
+
kind: 'scalar',
|
|
1481
|
+
T: 9 /*ScalarType.STRING*/,
|
|
1482
|
+
},
|
|
1483
|
+
]);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* @generated MessageType for protobuf message stream.video.sfu.models.RTMPIngress
|
|
1488
|
+
*/
|
|
1489
|
+
export const RTMPIngress = new RTMPIngress$Type();
|
|
1490
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
1429
1491
|
class Device$Type extends MessageType<Device> {
|
|
1430
1492
|
constructor() {
|
|
1431
1493
|
super('stream.video.sfu.models.Device', [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protobuf-ts 2.9.
|
|
1
|
+
// @generated by protobuf-ts 2.9.6 with parameter long_type_string,client_generic,server_none,eslint_disable,optimize_code_size
|
|
2
2
|
// @generated from protobuf file "video/sfu/signal_rpc/signal.proto" (package "stream.video.sfu.signal", syntax proto3)
|
|
3
3
|
// tslint:disable
|
|
4
4
|
import type {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protobuf-ts 2.9.
|
|
1
|
+
// @generated by protobuf-ts 2.9.6 with parameter long_type_string,client_generic,server_none,eslint_disable,optimize_code_size
|
|
2
2
|
// @generated from protobuf file "video/sfu/signal_rpc/signal.proto" (package "stream.video.sfu.signal", syntax proto3)
|
|
3
3
|
// tslint:disable
|
|
4
4
|
import {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ICETrickle,
|
|
9
9
|
InputDevices,
|
|
10
10
|
PeerType,
|
|
11
|
+
RTMPIngress,
|
|
11
12
|
TrackInfo,
|
|
12
13
|
TrackType,
|
|
13
14
|
VideoDimension,
|
|
@@ -152,6 +153,18 @@ export interface SendStatsRequest {
|
|
|
152
153
|
* @generated from protobuf field: stream.video.sfu.signal.Telemetry telemetry = 11;
|
|
153
154
|
*/
|
|
154
155
|
telemetry?: Telemetry;
|
|
156
|
+
/**
|
|
157
|
+
* @generated from protobuf field: stream.video.sfu.models.RTMPIngress rtmp = 12;
|
|
158
|
+
*/
|
|
159
|
+
rtmp?: RTMPIngress;
|
|
160
|
+
/**
|
|
161
|
+
* @generated from protobuf field: string subscriber_rtc_stats = 13;
|
|
162
|
+
*/
|
|
163
|
+
subscriberRtcStats: string;
|
|
164
|
+
/**
|
|
165
|
+
* @generated from protobuf field: string publisher_rtc_stats = 14;
|
|
166
|
+
*/
|
|
167
|
+
publisherRtcStats: string;
|
|
155
168
|
}
|
|
156
169
|
/**
|
|
157
170
|
* @generated from protobuf message stream.video.sfu.signal.SendStatsResponse
|
|
@@ -508,6 +521,19 @@ class SendStatsRequest$Type extends MessageType<SendStatsRequest> {
|
|
|
508
521
|
T: () => AppleState,
|
|
509
522
|
},
|
|
510
523
|
{ no: 11, name: 'telemetry', kind: 'message', T: () => Telemetry },
|
|
524
|
+
{ no: 12, name: 'rtmp', kind: 'message', T: () => RTMPIngress },
|
|
525
|
+
{
|
|
526
|
+
no: 13,
|
|
527
|
+
name: 'subscriber_rtc_stats',
|
|
528
|
+
kind: 'scalar',
|
|
529
|
+
T: 9 /*ScalarType.STRING*/,
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
no: 14,
|
|
533
|
+
name: 'publisher_rtc_stats',
|
|
534
|
+
kind: 'scalar',
|
|
535
|
+
T: 9 /*ScalarType.STRING*/,
|
|
536
|
+
},
|
|
511
537
|
]);
|
|
512
538
|
}
|
|
513
539
|
}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
createSignalClient,
|
|
4
4
|
withHeaders,
|
|
5
5
|
withRequestLogger,
|
|
6
|
+
withRequestTracer,
|
|
6
7
|
} from '../createClient';
|
|
7
8
|
import { TwirpFetchTransport } from '@protobuf-ts/twirp-transport';
|
|
8
9
|
|
|
@@ -35,4 +36,41 @@ describe('createClient', () => {
|
|
|
35
36
|
expect(next).toHaveBeenCalled();
|
|
36
37
|
expect(logger).toHaveBeenCalled();
|
|
37
38
|
});
|
|
39
|
+
|
|
40
|
+
it('withRequestTracer should add trace to the request', () => {
|
|
41
|
+
const trace = vi.fn();
|
|
42
|
+
const interceptor = withRequestTracer(trace);
|
|
43
|
+
const next = vi.fn();
|
|
44
|
+
interceptor.interceptUnary(
|
|
45
|
+
next,
|
|
46
|
+
// @ts-expect-error - invalid name
|
|
47
|
+
{ name: 'TestMethod' },
|
|
48
|
+
{ param: 'value' },
|
|
49
|
+
{ meta: {} },
|
|
50
|
+
);
|
|
51
|
+
expect(next).toHaveBeenCalled();
|
|
52
|
+
expect(trace).toHaveBeenCalledWith('TestMethod', { param: 'value' });
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('withRequestTracer should add an error trace', () => {
|
|
56
|
+
const trace = vi.fn();
|
|
57
|
+
const interceptor = withRequestTracer(trace);
|
|
58
|
+
const err = new Error('test error');
|
|
59
|
+
const next = vi.fn(() => {
|
|
60
|
+
throw err;
|
|
61
|
+
});
|
|
62
|
+
expect(() =>
|
|
63
|
+
interceptor.interceptUnary(
|
|
64
|
+
next,
|
|
65
|
+
// @ts-expect-error - invalid name
|
|
66
|
+
{ name: 'TestMethod' },
|
|
67
|
+
{ param: 'value' },
|
|
68
|
+
{ meta: {} },
|
|
69
|
+
),
|
|
70
|
+
).toThrow('test error');
|
|
71
|
+
expect(trace).toHaveBeenLastCalledWith('TestMethodOnFailure', [
|
|
72
|
+
{ param: 'value' },
|
|
73
|
+
err,
|
|
74
|
+
]);
|
|
75
|
+
});
|
|
38
76
|
});
|
package/src/rpc/createClient.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from '@protobuf-ts/twirp-transport';
|
|
12
12
|
import { SignalServerClient } from '../gen/video/sfu/signal_rpc/signal.client';
|
|
13
13
|
import { Logger, LogLevel } from '../coordinator/connection/types';
|
|
14
|
+
import type { Trace } from '../stats/rtc/types';
|
|
14
15
|
|
|
15
16
|
const defaultOptions: TwirpOptions = {
|
|
16
17
|
baseUrl: '',
|
|
@@ -63,6 +64,35 @@ export const withRequestLogger = (
|
|
|
63
64
|
};
|
|
64
65
|
};
|
|
65
66
|
|
|
67
|
+
export const withRequestTracer = (trace: Trace): RpcInterceptor => {
|
|
68
|
+
type RpcMethodNames = {
|
|
69
|
+
[K in keyof SignalServerClient as Capitalize<K>]: boolean;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const exclusions: Record<string, boolean | undefined> = {
|
|
73
|
+
SendStats: true,
|
|
74
|
+
} satisfies Partial<RpcMethodNames>;
|
|
75
|
+
return {
|
|
76
|
+
interceptUnary(
|
|
77
|
+
next: NextUnaryFn,
|
|
78
|
+
method: MethodInfo,
|
|
79
|
+
input: object,
|
|
80
|
+
options: RpcOptions,
|
|
81
|
+
): UnaryCall {
|
|
82
|
+
if (exclusions[method.name as keyof RpcMethodNames]) {
|
|
83
|
+
return next(method, input, options);
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
trace(method.name, input);
|
|
87
|
+
return next(method, input, options);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
trace(`${method.name}OnFailure`, [input, err]);
|
|
90
|
+
throw err;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
66
96
|
/**
|
|
67
97
|
* Creates new SignalServerClient instance.
|
|
68
98
|
*
|