@daily-co/react-native-daily-js 0.41.0 → 0.42.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daily-co/react-native-daily-js",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "React Native library for making video calls using Daily",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "baseUrl": "https://github.com/daily-co/react-native-daily-js"
27
27
  },
28
28
  "dependencies": {
29
- "@daily-co/daily-js": "^0.43.0",
29
+ "@daily-co/daily-js": "^0.44.0",
30
30
  "@types/react-native-background-timer": "^2.0.0",
31
31
  "react-native-url-polyfill": "^1.1.2"
32
32
  },
@@ -12,6 +12,8 @@ import {
12
12
  MediaTrackConstraints,
13
13
  } from '@daily-co/react-native-webrtc';
14
14
 
15
+ import RTCRtpEncodingParameters from '@daily-co/react-native-webrtc/lib/typescript/RTCRtpEncodingParameters';
16
+
15
17
  /**
16
18
  * --- DAILY-JS API EXPOSED VIA REACT-NATIVE-DAILY-JS ---
17
19
  */
@@ -77,7 +79,8 @@ export type DailyEvent =
77
79
  | 'waiting-participant-updated'
78
80
  | 'waiting-participant-removed'
79
81
  | 'available-devices-updated'
80
- | 'receive-settings-updated';
82
+ | 'receive-settings-updated'
83
+ | 'send-settings-updated';
81
84
 
82
85
  export type DailyMeetingState =
83
86
  | 'new'
@@ -364,6 +367,30 @@ export interface DailyCpuLoadStats {
364
367
  };
365
368
  }
366
369
 
370
+ interface DailySendSettings {
371
+ video?: DailyVideoSendSettings | DailyVideoSendSettingsPreset;
372
+ customVideoDefaults?: DailyVideoSendSettings | DailyVideoSendSettingsPreset;
373
+ [customKey: string]:
374
+ | DailyVideoSendSettings
375
+ | DailyVideoSendSettingsPreset
376
+ | undefined;
377
+ }
378
+
379
+ export type DailyVideoSendSettingsPreset =
380
+ | 'default'
381
+ | 'bandwidth-optimized'
382
+ | 'quality-optimized';
383
+
384
+ // Media Track Send Settings
385
+ interface DailyVideoSendSettings {
386
+ maxQuality?: 'low' | 'medium' | 'high';
387
+ encodings?: {
388
+ low: RTCRtpEncodingParameters;
389
+ medium: RTCRtpEncodingParameters;
390
+ high: RTCRtpEncodingParameters;
391
+ };
392
+ }
393
+
367
394
  export interface DailyPendingRoomInfo {
368
395
  roomUrlPendingJoin: string;
369
396
  }
@@ -654,7 +681,7 @@ export interface DailyEventObjectRecordingStarted {
654
681
  recordingId?: string;
655
682
  startedBy?: string;
656
683
  type?: string;
657
- layout?: DailyStreamingLayoutConfig;
684
+ layout?: DailyStreamingLayoutConfig<'start'>;
658
685
  instanceId?: string;
659
686
  }
660
687
 
@@ -715,9 +742,14 @@ export interface DailyEventObjectAvailableDevicesUpdated {
715
742
  availableDevices: MediaDeviceInfo[];
716
743
  }
717
744
 
745
+ export interface DailyEventObjectSendSettingsUpdated {
746
+ action: Extract<DailyEvent, 'send-settings-updated'>;
747
+ sendSettings: DailySendSettings;
748
+ }
749
+
718
750
  export interface DailyEventObjectLiveStreamingStarted {
719
751
  action: Extract<DailyEvent, 'live-streaming-started'>;
720
- layout?: DailyStreamingLayoutConfig;
752
+ layout?: DailyLiveStreamingLayoutConfig<'start'>;
721
753
  instanceId?: string;
722
754
  }
723
755
  export interface DailyEventObjectLiveStreamingUpdated {
@@ -820,6 +852,8 @@ export type DailyEventObject<T extends DailyEvent = any> =
820
852
  ? DailyEventObjectReceiveSettingsUpdated
821
853
  : T extends DailyEventObjectAvailableDevicesUpdated['action']
822
854
  ? DailyEventObjectAvailableDevicesUpdated
855
+ : T extends DailyEventObjectSendSettingsUpdated['action']
856
+ ? DailyEventObjectSendSettingsUpdated
823
857
  : any;
824
858
 
825
859
  export type DailyNativeInCallAudioMode = 'video' | 'voice';
@@ -835,7 +869,16 @@ export interface DailyCallStaticUtils {
835
869
 
836
870
  export type DailyCameraFacingMode = 'user' | 'environment';
837
871
 
838
- export interface DailyStreamingDefaultLayoutConfig {
872
+ type DailyStreamingParticipantsSortMethod = 'active';
873
+
874
+ export interface DailyStreamingParticipantsConfig {
875
+ video?: string[];
876
+ audio?: string[];
877
+ sort?: DailyStreamingParticipantsSortMethod;
878
+ }
879
+
880
+ export interface DailyStreamingDefaultLayoutConfig
881
+ extends DailyStreamingParticipantsConfig {
839
882
  preset: 'default';
840
883
  max_cam_streams?: number;
841
884
  }
@@ -845,35 +888,62 @@ export interface DailyStreamingSingleParticipantLayoutConfig {
845
888
  session_id: string;
846
889
  }
847
890
 
848
- export interface DailyStreamingActiveParticipantLayoutConfig {
891
+ export interface DailyStreamingActiveParticipantLayoutConfig
892
+ extends DailyStreamingParticipantsConfig {
849
893
  preset: 'active-participant';
850
894
  }
851
895
 
896
+ export interface DailyStreamingAudioOnlyLayoutConfig {
897
+ preset: 'audio-only';
898
+ }
899
+
852
900
  export type DailyStreamingPortraitLayoutVariant = 'vertical' | 'inset';
853
901
 
854
- export interface DailyStreamingPortraitLayoutConfig {
902
+ export interface DailyStreamingPortraitLayoutConfig
903
+ extends DailyStreamingParticipantsConfig {
855
904
  preset: 'portrait';
856
905
  variant?: DailyStreamingPortraitLayoutVariant;
857
906
  max_cam_streams?: number;
858
907
  }
859
908
 
860
- export interface DailyStreamingCustomLayoutConfig {
909
+ export interface DailyUpdateStreamingCustomLayoutConfig
910
+ extends DailyStreamingParticipantsConfig {
861
911
  preset: 'custom';
862
- composition_id?: string;
863
912
  composition_params?: {
864
913
  [key: string]: boolean | number | string;
865
914
  };
915
+ }
916
+
917
+ export interface DailyStartStreamingCustomLayoutConfig
918
+ extends DailyUpdateStreamingCustomLayoutConfig,
919
+ DailyStreamingParticipantsConfig {
920
+ composition_id?: string;
866
921
  session_assets?: {
867
922
  [key: string]: string;
868
923
  };
869
924
  }
870
925
 
871
- export type DailyStreamingLayoutConfig =
926
+ type DailyStreamingLayoutConfigType = 'start' | 'update';
927
+ type DailyStartStreamingMethod = 'liveStreaming' | 'recording';
928
+
929
+ export type DailyStreamingLayoutConfig<
930
+ Type extends DailyStreamingLayoutConfigType = 'start'
931
+ > =
872
932
  | DailyStreamingDefaultLayoutConfig
873
933
  | DailyStreamingSingleParticipantLayoutConfig
874
934
  | DailyStreamingActiveParticipantLayoutConfig
875
935
  | DailyStreamingPortraitLayoutConfig
876
- | DailyStreamingCustomLayoutConfig;
936
+ | DailyStreamingAudioOnlyLayoutConfig
937
+ | (Type extends 'start'
938
+ ? DailyStartStreamingCustomLayoutConfig
939
+ : DailyUpdateStreamingCustomLayoutConfig);
940
+
941
+ export type DailyLiveStreamingLayoutConfig<
942
+ Type extends DailyStreamingLayoutConfigType = 'start'
943
+ > = Exclude<
944
+ DailyStreamingLayoutConfig<Type>,
945
+ DailyStreamingAudioOnlyLayoutConfig
946
+ >;
877
947
 
878
948
  export type DailyStreamingState = 'connected' | 'interrupted';
879
949
 
@@ -905,7 +975,10 @@ export type DailyAccessRequest = {
905
975
  name: string;
906
976
  };
907
977
 
908
- export interface DailyStreamingOptions {
978
+ export interface DailyStreamingOptions<
979
+ Method extends DailyStartStreamingMethod,
980
+ Type extends DailyStreamingLayoutConfigType = 'start'
981
+ > {
909
982
  width?: number;
910
983
  height?: number;
911
984
  fps?: number;
@@ -915,14 +988,18 @@ export interface DailyStreamingOptions {
915
988
  maxDuration?: number;
916
989
  backgroundColor?: string;
917
990
  instanceId?: string;
918
- layout?: DailyStreamingLayoutConfig;
991
+ layout?: Method extends 'recording'
992
+ ? DailyStreamingLayoutConfig<Type>
993
+ : DailyLiveStreamingLayoutConfig<Type>;
919
994
  }
920
995
 
921
996
  export interface DailyStreamingEndpoint {
922
997
  endpoint: string;
923
998
  }
924
999
 
925
- export interface DailyLiveStreamingOptions extends DailyStreamingOptions {
1000
+ export interface DailyLiveStreamingOptions<
1001
+ Type extends DailyStreamingLayoutConfigType = 'start'
1002
+ > extends DailyStreamingOptions<'liveStreaming', Type> {
926
1003
  rtmpUrl?: string | string[];
927
1004
  endpoints?: DailyStreamingEndpoint[];
928
1005
  }
@@ -1024,9 +1101,15 @@ export interface DailyCall {
1024
1101
  inCallAudioMode: DailyNativeInCallAudioMode
1025
1102
  ): DailyCall;
1026
1103
  getInputDevices(): Promise<DailyDeviceInfos>;
1027
- startLiveStreaming(options: DailyLiveStreamingOptions): void;
1104
+ startRecording(options?: DailyStreamingOptions<'recording', 'start'>): void;
1105
+ updateRecording(options: {
1106
+ layout?: DailyStreamingLayoutConfig<'update'>;
1107
+ instanceId?: string;
1108
+ }): void;
1109
+ stopRecording(options?: { instanceId: string }): void;
1110
+ startLiveStreaming(options: DailyLiveStreamingOptions<'start'>): void;
1028
1111
  updateLiveStreaming(options: {
1029
- layout?: DailyStreamingLayoutConfig;
1112
+ layout?: DailyLiveStreamingLayoutConfig<'update'>;
1030
1113
  instanceId?: string;
1031
1114
  }): void;
1032
1115
  addLiveStreamingEndpoints(options: {
@@ -1049,14 +1132,10 @@ export interface DailyCall {
1049
1132
  stopTranscription(): void;
1050
1133
  preAuth(properties?: DailyCallOptions): Promise<{ access: DailyAccess }>;
1051
1134
  load(properties?: DailyLoadOptions): Promise<void>;
1052
- startRecording(options?: DailyStreamingOptions): void;
1053
- updateRecording(options: {
1054
- layout?: DailyStreamingLayoutConfig;
1055
- instanceId?: string;
1056
- }): void;
1057
- stopRecording(options?: { instanceId: string }): void;
1058
1135
  getNetworkStats(): Promise<DailyNetworkStats>;
1059
1136
  getCpuLoadStats(): Promise<DailyCpuLoadStats>;
1137
+ updateSendSettings(settings: DailySendSettings): Promise<DailySendSettings>;
1138
+ getSendSettings(): DailySendSettings;
1060
1139
  subscribeToTracksAutomatically(): boolean;
1061
1140
  setSubscribeToTracksAutomatically(enabled: boolean): DailyCall;
1062
1141
  enumerateDevices(): Promise<{ devices: MediaDeviceInfo[] }>;