@stream-io/video-client 0.7.0 → 0.7.2

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.
@@ -1,7 +1,7 @@
1
1
  import { Publisher, Subscriber } from './rtc';
2
2
  import { TrackType } from './gen/video/sfu/models/models';
3
3
  import { CallState } from './store';
4
- import { AcceptCallResponse, BlockUserResponse, EndCallResponse, GetCallResponse, GetCallStatsResponse, GetOrCreateCallRequest, GetOrCreateCallResponse, GoLiveRequest, GoLiveResponse, ListRecordingsResponse, ListTranscriptionsResponse, MuteUsersResponse, PinRequest, PinResponse, QueryMembersRequest, QueryMembersResponse, RejectCallResponse, RequestPermissionRequest, RequestPermissionResponse, SendEventResponse, SendReactionRequest, SendReactionResponse, StartHLSBroadcastingResponse, StartRecordingRequest, StartRecordingResponse, StartTranscriptionRequest, StartTranscriptionResponse, StopHLSBroadcastingResponse, StopLiveResponse, StopRecordingResponse, StopTranscriptionResponse, UnblockUserResponse, UnpinRequest, UnpinResponse, UpdateCallMembersRequest, UpdateCallMembersResponse, UpdateCallRequest, UpdateCallResponse, UpdateUserPermissionsRequest, UpdateUserPermissionsResponse } from './gen/coordinator';
4
+ import { AcceptCallResponse, BlockUserResponse, CollectUserFeedbackResponse, EndCallResponse, GetCallResponse, GetCallStatsResponse, GetOrCreateCallRequest, GetOrCreateCallResponse, GoLiveRequest, GoLiveResponse, ListRecordingsResponse, ListTranscriptionsResponse, MuteUsersResponse, PinRequest, PinResponse, QueryMembersRequest, QueryMembersResponse, RejectCallResponse, RequestPermissionRequest, RequestPermissionResponse, SendEventResponse, SendReactionRequest, SendReactionResponse, StartHLSBroadcastingResponse, StartRecordingRequest, StartRecordingResponse, StartTranscriptionRequest, StartTranscriptionResponse, StopHLSBroadcastingResponse, StopLiveResponse, StopRecordingResponse, StopTranscriptionResponse, UnblockUserResponse, UnpinRequest, UnpinResponse, UpdateCallMembersRequest, UpdateCallMembersResponse, UpdateCallRequest, UpdateCallResponse, UpdateUserPermissionsRequest, UpdateUserPermissionsResponse } from './gen/coordinator';
5
5
  import { AudioTrackType, CallConstructor, CallLeaveOptions, DebounceType, JoinCallData, PublishOptions, SubscriptionChanges, TrackMuteType, VideoTrackType } from './types';
6
6
  import { VideoLayerSetting } from './gen/video/sfu/event/events';
7
7
  import { DynascaleManager } from './helpers/DynascaleManager';
@@ -470,6 +470,18 @@ export declare class Call {
470
470
  * @returns The call stats.
471
471
  */
472
472
  getCallStats: (callSessionID: string) => Promise<GetCallStatsResponse>;
473
+ /**
474
+ * Submit user feedback for the call
475
+ *
476
+ * @param rating Rating between 1 and 5 denoting the experience of the user in the call
477
+ * @param reason The reason/description for the rating
478
+ * @param custom Custom data
479
+ * @returns
480
+ */
481
+ submitFeedback: (rating: number, { reason, custom, }?: {
482
+ reason?: string | undefined;
483
+ custom?: Record<string, any> | undefined;
484
+ }) => Promise<CollectUserFeedbackResponse>;
473
485
  /**
474
486
  * Sends a custom event to all call participants.
475
487
  *
@@ -467,6 +467,7 @@ export interface CallEndedEvent {
467
467
  user?: UserResponse;
468
468
  }
469
469
  /**
470
+ *
470
471
  * @export
471
472
  * @interface CallEvent
472
473
  */
@@ -477,6 +478,12 @@ export interface CallEvent {
477
478
  * @memberof CallEvent
478
479
  */
479
480
  description: string;
481
+ /**
482
+ *
483
+ * @type {number}
484
+ * @memberof CallEvent
485
+ */
486
+ end_timestamp: number;
480
487
  /**
481
488
  *
482
489
  * @type {number}
@@ -1660,41 +1667,47 @@ export interface CallStateResponseFields {
1660
1667
  own_capabilities: Array<OwnCapability>;
1661
1668
  }
1662
1669
  /**
1663
- * CallTranscription represents a transcription of a call.
1670
+ *
1664
1671
  * @export
1665
1672
  * @interface CallStatsReportSummaryResponse
1666
1673
  */
1667
1674
  export interface CallStatsReportSummaryResponse {
1668
1675
  /**
1669
1676
  *
1670
- * @type {number}
1677
+ * @type {string}
1671
1678
  * @memberof CallStatsReportSummaryResponse
1672
1679
  */
1673
- app_pk: number;
1680
+ call_cid: string;
1674
1681
  /**
1675
1682
  *
1676
1683
  * @type {string}
1677
1684
  * @memberof CallStatsReportSummaryResponse
1678
1685
  */
1679
- call_cid: string;
1686
+ call_session_id: string;
1680
1687
  /**
1681
1688
  *
1682
1689
  * @type {string}
1683
1690
  * @memberof CallStatsReportSummaryResponse
1684
1691
  */
1685
- call_session_id: string;
1692
+ call_status: string;
1686
1693
  /**
1687
1694
  *
1688
1695
  * @type {string}
1689
1696
  * @memberof CallStatsReportSummaryResponse
1690
1697
  */
1691
- call_status: string;
1698
+ created_at?: string;
1692
1699
  /**
1693
1700
  *
1694
1701
  * @type {string}
1695
1702
  * @memberof CallStatsReportSummaryResponse
1696
1703
  */
1697
1704
  first_stats_time: string;
1705
+ /**
1706
+ *
1707
+ * @type {number}
1708
+ * @memberof CallStatsReportSummaryResponse
1709
+ */
1710
+ quality_score?: number;
1698
1711
  }
1699
1712
  /**
1700
1713
  *
@@ -2092,6 +2105,64 @@ export interface ClosedCaptionEvent {
2092
2105
  */
2093
2106
  type: string;
2094
2107
  }
2108
+ /**
2109
+ *
2110
+ * @export
2111
+ * @interface CollectUserFeedbackRequest
2112
+ */
2113
+ export interface CollectUserFeedbackRequest {
2114
+ /**
2115
+ *
2116
+ * @type {object}
2117
+ * @memberof CollectUserFeedbackRequest
2118
+ */
2119
+ custom?: {
2120
+ [key: string]: any;
2121
+ };
2122
+ /**
2123
+ *
2124
+ * @type {number}
2125
+ * @memberof CollectUserFeedbackRequest
2126
+ */
2127
+ rating?: number;
2128
+ /**
2129
+ *
2130
+ * @type {string}
2131
+ * @memberof CollectUserFeedbackRequest
2132
+ */
2133
+ reason?: string;
2134
+ /**
2135
+ *
2136
+ * @type {string}
2137
+ * @memberof CollectUserFeedbackRequest
2138
+ */
2139
+ sdk: string;
2140
+ /**
2141
+ *
2142
+ * @type {string}
2143
+ * @memberof CollectUserFeedbackRequest
2144
+ */
2145
+ sdk_version: string;
2146
+ /**
2147
+ *
2148
+ * @type {string}
2149
+ * @memberof CollectUserFeedbackRequest
2150
+ */
2151
+ user_session_id: string;
2152
+ }
2153
+ /**
2154
+ *
2155
+ * @export
2156
+ * @interface CollectUserFeedbackResponse
2157
+ */
2158
+ export interface CollectUserFeedbackResponse {
2159
+ /**
2160
+ * Duration of the request in human-readable format
2161
+ * @type {string}
2162
+ * @memberof CollectUserFeedbackResponse
2163
+ */
2164
+ duration: string;
2165
+ }
2095
2166
  /**
2096
2167
  *
2097
2168
  * @export
@@ -2568,6 +2639,49 @@ export interface GeofenceSettingsRequest {
2568
2639
  */
2569
2640
  names?: Array<string>;
2570
2641
  }
2642
+ /**
2643
+ *
2644
+ * @export
2645
+ * @interface GeolocationResult
2646
+ */
2647
+ export interface GeolocationResult {
2648
+ /**
2649
+ *
2650
+ * @type {number}
2651
+ * @memberof GeolocationResult
2652
+ */
2653
+ accuracy_radius: number;
2654
+ /**
2655
+ *
2656
+ * @type {string}
2657
+ * @memberof GeolocationResult
2658
+ */
2659
+ continent_code: string;
2660
+ /**
2661
+ *
2662
+ * @type {string}
2663
+ * @memberof GeolocationResult
2664
+ */
2665
+ country_iso_code: string;
2666
+ /**
2667
+ *
2668
+ * @type {number}
2669
+ * @memberof GeolocationResult
2670
+ */
2671
+ latitude: number;
2672
+ /**
2673
+ *
2674
+ * @type {number}
2675
+ * @memberof GeolocationResult
2676
+ */
2677
+ longitude: number;
2678
+ /**
2679
+ *
2680
+ * @type {string}
2681
+ * @memberof GeolocationResult
2682
+ */
2683
+ subdivision_iso_code: string;
2684
+ }
2571
2685
  /**
2572
2686
  *
2573
2687
  * @export
@@ -2641,6 +2755,18 @@ export interface GetCallStatsResponse {
2641
2755
  * @memberof GetCallStatsResponse
2642
2756
  */
2643
2757
  duration: string;
2758
+ /**
2759
+ *
2760
+ * @type {number}
2761
+ * @memberof GetCallStatsResponse
2762
+ */
2763
+ max_jitter: number;
2764
+ /**
2765
+ *
2766
+ * @type {number}
2767
+ * @memberof GetCallStatsResponse
2768
+ */
2769
+ max_latency: number;
2644
2770
  /**
2645
2771
  *
2646
2772
  * @type {number}
@@ -4219,6 +4345,31 @@ export interface StopTranscriptionResponse {
4219
4345
  */
4220
4346
  duration: string;
4221
4347
  }
4348
+ /**
4349
+ *
4350
+ * @export
4351
+ * @interface Subsession
4352
+ */
4353
+ export interface Subsession {
4354
+ /**
4355
+ *
4356
+ * @type {number}
4357
+ * @memberof Subsession
4358
+ */
4359
+ ended_at: number;
4360
+ /**
4361
+ *
4362
+ * @type {number}
4363
+ * @memberof Subsession
4364
+ */
4365
+ joined_at: number;
4366
+ /**
4367
+ *
4368
+ * @type {string}
4369
+ * @memberof Subsession
4370
+ */
4371
+ sfu_id: string;
4372
+ }
4222
4373
  /**
4223
4374
  *
4224
4375
  * @export
@@ -4785,16 +4936,59 @@ export interface UserResponse {
4785
4936
  updated_at: string;
4786
4937
  }
4787
4938
  /**
4939
+ *
4788
4940
  * @export
4789
4941
  * @interface UserSessionStats
4790
4942
  */
4791
4943
  export interface UserSessionStats {
4944
+ /**
4945
+ *
4946
+ * @type {string}
4947
+ * @memberof UserSessionStats
4948
+ */
4949
+ browser?: string;
4950
+ /**
4951
+ *
4952
+ * @type {string}
4953
+ * @memberof UserSessionStats
4954
+ */
4955
+ browser_version?: string;
4956
+ /**
4957
+ *
4958
+ * @type {string}
4959
+ * @memberof UserSessionStats
4960
+ */
4961
+ current_ip?: string;
4962
+ /**
4963
+ *
4964
+ * @type {string}
4965
+ * @memberof UserSessionStats
4966
+ */
4967
+ current_sfu?: string;
4968
+ /**
4969
+ *
4970
+ * @type {string}
4971
+ * @memberof UserSessionStats
4972
+ */
4973
+ device_model?: string;
4974
+ /**
4975
+ *
4976
+ * @type {string}
4977
+ * @memberof UserSessionStats
4978
+ */
4979
+ device_version?: string;
4792
4980
  /**
4793
4981
  *
4794
4982
  * @type {number}
4795
4983
  * @memberof UserSessionStats
4796
4984
  */
4797
4985
  freeze_duration_seconds: number;
4986
+ /**
4987
+ *
4988
+ * @type {GeolocationResult}
4989
+ * @memberof UserSessionStats
4990
+ */
4991
+ geolocation?: GeolocationResult;
4798
4992
  /**
4799
4993
  *
4800
4994
  * @type {Stats}
@@ -4807,18 +5001,72 @@ export interface UserSessionStats {
4807
5001
  * @memberof UserSessionStats
4808
5002
  */
4809
5003
  latency?: Stats;
5004
+ /**
5005
+ *
5006
+ * @type {number}
5007
+ * @memberof UserSessionStats
5008
+ */
5009
+ max_fir_per_minute?: number;
5010
+ /**
5011
+ *
5012
+ * @type {number}
5013
+ * @memberof UserSessionStats
5014
+ */
5015
+ max_freezes_per_minute?: number;
5016
+ /**
5017
+ *
5018
+ * @type {number}
5019
+ * @memberof UserSessionStats
5020
+ */
5021
+ max_nack_per_minute?: number;
5022
+ /**
5023
+ *
5024
+ * @type {number}
5025
+ * @memberof UserSessionStats
5026
+ */
5027
+ max_pli_per_minute?: number;
5028
+ /**
5029
+ *
5030
+ * @type {VideoQuality}
5031
+ * @memberof UserSessionStats
5032
+ */
5033
+ max_publishing_video_quality?: VideoQuality;
5034
+ /**
5035
+ *
5036
+ * @type {VideoQuality}
5037
+ * @memberof UserSessionStats
5038
+ */
5039
+ max_receiving_video_quality?: VideoQuality;
5040
+ /**
5041
+ *
5042
+ * @type {string}
5043
+ * @memberof UserSessionStats
5044
+ */
5045
+ os?: string;
4810
5046
  /**
4811
5047
  *
4812
5048
  * @type {string}
4813
5049
  * @memberof UserSessionStats
4814
5050
  */
4815
- os: string;
5051
+ os_version?: string;
4816
5052
  /**
4817
5053
  *
4818
5054
  * @type {number}
4819
5055
  * @memberof UserSessionStats
4820
5056
  */
4821
5057
  packet_loss_fraction: number;
5058
+ /**
5059
+ *
5060
+ * @type {string}
5061
+ * @memberof UserSessionStats
5062
+ */
5063
+ publishing_audio_codec?: string;
5064
+ /**
5065
+ *
5066
+ * @type {number}
5067
+ * @memberof UserSessionStats
5068
+ */
5069
+ publishing_duration_seconds: number;
4822
5070
  /**
4823
5071
  *
4824
5072
  * @type {number}
@@ -4830,25 +5078,55 @@ export interface UserSessionStats {
4830
5078
  * @type {string}
4831
5079
  * @memberof UserSessionStats
4832
5080
  */
4833
- sdk: string;
5081
+ receiving_audio_codec?: string;
5082
+ /**
5083
+ *
5084
+ * @type {number}
5085
+ * @memberof UserSessionStats
5086
+ */
5087
+ receiving_duration_seconds: number;
4834
5088
  /**
4835
5089
  *
4836
5090
  * @type {string}
4837
5091
  * @memberof UserSessionStats
4838
5092
  */
4839
- sdk_version: string;
5093
+ sdk?: string;
5094
+ /**
5095
+ *
5096
+ * @type {string}
5097
+ * @memberof UserSessionStats
5098
+ */
5099
+ sdk_version?: string;
5100
+ /**
5101
+ *
5102
+ * @type {Array<Subsession>}
5103
+ * @memberof UserSessionStats
5104
+ */
5105
+ subsessions?: Array<Subsession>;
4840
5106
  /**
4841
5107
  *
4842
5108
  * @type {CallTimeline}
4843
5109
  * @memberof UserSessionStats
4844
5110
  */
4845
5111
  timeline?: CallTimeline;
5112
+ /**
5113
+ *
5114
+ * @type {number}
5115
+ * @memberof UserSessionStats
5116
+ */
5117
+ total_pixels_in: number;
5118
+ /**
5119
+ *
5120
+ * @type {number}
5121
+ * @memberof UserSessionStats
5122
+ */
5123
+ total_pixels_out: number;
4846
5124
  /**
4847
5125
  *
4848
5126
  * @type {string}
4849
5127
  * @memberof UserSessionStats
4850
5128
  */
4851
- webrtc_version: string;
5129
+ webrtc_version?: string;
4852
5130
  }
4853
5131
  /**
4854
5132
  *
@@ -4963,6 +5241,38 @@ export declare const VideoSettingsRequestCameraFacingEnum: {
4963
5241
  readonly EXTERNAL: "external";
4964
5242
  };
4965
5243
  export type VideoSettingsRequestCameraFacingEnum = (typeof VideoSettingsRequestCameraFacingEnum)[keyof typeof VideoSettingsRequestCameraFacingEnum];
5244
+ /**
5245
+ *
5246
+ * @export
5247
+ * @interface VideoQuality
5248
+ */
5249
+ export interface VideoQuality {
5250
+ /**
5251
+ *
5252
+ * @type {VideoResolution}
5253
+ * @memberof VideoQuality
5254
+ */
5255
+ resolution: VideoResolution;
5256
+ }
5257
+ /**
5258
+ *
5259
+ * @export
5260
+ * @interface VideoResolution
5261
+ */
5262
+ export interface VideoResolution {
5263
+ /**
5264
+ *
5265
+ * @type {number}
5266
+ * @memberof VideoResolution
5267
+ */
5268
+ height: number;
5269
+ /**
5270
+ *
5271
+ * @type {number}
5272
+ * @memberof VideoResolution
5273
+ */
5274
+ width: number;
5275
+ }
4966
5276
  /**
4967
5277
  *
4968
5278
  * @export
@@ -1,6 +1,17 @@
1
+ import { LocalClientDetailsType } from '../client-details';
1
2
  /**
2
3
  * Flatten the stats report into an array of stats objects.
3
4
  *
4
5
  * @param report the report to flatten.
5
6
  */
6
7
  export declare const flatten: (report: RTCStatsReport) => RTCStats[];
8
+ export declare const getSdkSignature: (clientDetails: LocalClientDetailsType) => {
9
+ os?: import("../gen/video/sfu/models/models").OS | undefined;
10
+ browser?: import("../gen/video/sfu/models/models").Browser | undefined;
11
+ device?: import("../gen/video/sfu/models/models").Device | undefined;
12
+ webRTCInfo?: {
13
+ version: string;
14
+ } | undefined;
15
+ sdkName: string;
16
+ sdkVersion: string;
17
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
package/src/Call.ts CHANGED
@@ -22,6 +22,8 @@ import {
22
22
  AcceptCallResponse,
23
23
  BlockUserRequest,
24
24
  BlockUserResponse,
25
+ CollectUserFeedbackRequest,
26
+ CollectUserFeedbackResponse,
25
27
  EndCallResponse,
26
28
  GetCallResponse,
27
29
  GetCallStatsResponse,
@@ -123,6 +125,7 @@ import {
123
125
  ScreenShareManager,
124
126
  SpeakerManager,
125
127
  } from './devices';
128
+ import { getSdkSignature } from './stats/utils';
126
129
 
127
130
  /**
128
131
  * An object representation of a `Call`.
@@ -1909,6 +1912,56 @@ export class Call {
1909
1912
  return this.streamClient.get<GetCallStatsResponse>(endpoint);
1910
1913
  };
1911
1914
 
1915
+ /**
1916
+ * Submit user feedback for the call
1917
+ *
1918
+ * @param rating Rating between 1 and 5 denoting the experience of the user in the call
1919
+ * @param reason The reason/description for the rating
1920
+ * @param custom Custom data
1921
+ * @returns
1922
+ */
1923
+ submitFeedback = async (
1924
+ rating: number,
1925
+ {
1926
+ reason,
1927
+ custom,
1928
+ }: {
1929
+ reason?: string;
1930
+ custom?: Record<string, any>;
1931
+ } = {},
1932
+ ) => {
1933
+ if (rating < 1 || rating > 5) {
1934
+ throw new Error('Rating must be between 1 and 5');
1935
+ }
1936
+ const userSessionId = this.sfuClient?.sessionId;
1937
+ const callSessionId = this.state.session?.id;
1938
+ if (!callSessionId || !userSessionId) {
1939
+ throw new Error(
1940
+ 'Feedback can be submitted only in the context of a call session',
1941
+ );
1942
+ }
1943
+
1944
+ const { sdkName, sdkVersion, ...platform } = getSdkSignature(
1945
+ getClientDetails(),
1946
+ );
1947
+
1948
+ const endpoint = `${this.streamClientBasePath}/feedback/${callSessionId}`;
1949
+ return this.streamClient.post<
1950
+ CollectUserFeedbackResponse,
1951
+ CollectUserFeedbackRequest
1952
+ >(endpoint, {
1953
+ rating,
1954
+ reason,
1955
+ user_session_id: userSessionId,
1956
+ sdk: sdkName,
1957
+ sdk_version: sdkVersion,
1958
+ custom: {
1959
+ ...custom,
1960
+ 'x-stream-platform-data': platform,
1961
+ },
1962
+ });
1963
+ };
1964
+
1912
1965
  /**
1913
1966
  * Sends a custom event to all call participants.
1914
1967
  *