@daily-co/react-native-daily-js 0.68.0 → 0.70.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.
@@ -2,7 +2,9 @@ package com.daily.reactlibrary;
2
2
 
3
3
  import android.Manifest;
4
4
  import android.app.Activity;
5
+ import android.content.Context;
5
6
  import android.content.Intent;
7
+ import android.content.pm.PackageInfo;
6
8
  import android.content.pm.PackageManager;
7
9
  import android.os.Build;
8
10
  import android.os.Process;
@@ -129,10 +131,33 @@ public class DailyNativeUtils extends ReactContextBaseJavaModule implements Perm
129
131
  return true;
130
132
  }
131
133
 
134
+ private List<String> getDeclaredPermissions(Context context) {
135
+ List<String> declaredPermissions = new ArrayList<>();
136
+ try {
137
+ PackageInfo packageInfo = context.getPackageManager().getPackageInfo(
138
+ context.getPackageName(),
139
+ PackageManager.GET_PERMISSIONS
140
+ );
141
+ // Check if permissions are requested
142
+ if (packageInfo.requestedPermissions != null) {
143
+ declaredPermissions = Arrays.asList(packageInfo.requestedPermissions);
144
+ }
145
+ } catch (PackageManager.NameNotFoundException e) {
146
+ e.printStackTrace();
147
+ }
148
+ return declaredPermissions;
149
+ }
150
+
132
151
  private void checkPermissions() {
152
+ Context applicationContext = this.reactContext.getApplicationContext();
153
+ List<String> declaredPermissions = this.getDeclaredPermissions(applicationContext);
133
154
  List<String> permissionList = new ArrayList<String>();
134
- permissionList.add(Manifest.permission.CAMERA);
135
- permissionList.add(Manifest.permission.RECORD_AUDIO);
155
+ if (declaredPermissions.contains(Manifest.permission.FOREGROUND_SERVICE_CAMERA)) {
156
+ permissionList.add(Manifest.permission.CAMERA);
157
+ }
158
+ if (declaredPermissions.contains(Manifest.permission.FOREGROUND_SERVICE_MICROPHONE)) {
159
+ permissionList.add(Manifest.permission.RECORD_AUDIO);
160
+ }
136
161
  if (Build.VERSION.SDK_INT >= 33) {
137
162
  permissionList.add(Manifest.permission.POST_NOTIFICATIONS);
138
163
  }
package/dist/index.js CHANGED
@@ -105,6 +105,7 @@ function setupGlobals() {
105
105
  (0, react_native_webrtc_1.registerGlobals)();
106
106
  // A shim to prevent errors in call machine bundle (not ideal)
107
107
  global.window.addEventListener = function () { };
108
+ global.window.removeEventListener = function () { };
108
109
  global.btoa = base_64_1.encode;
109
110
  global.atob = base_64_1.decode;
110
111
  // A workaround for iOS HTTP cache not caching call object bundle due to size
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daily-co/react-native-daily-js",
3
- "version": "0.68.0",
3
+ "version": "0.70.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",
@@ -28,7 +28,7 @@
28
28
  "baseUrl": "https://github.com/daily-co/react-native-daily-js"
29
29
  },
30
30
  "dependencies": {
31
- "@daily-co/daily-js": "^0.70.0",
31
+ "@daily-co/daily-js": "^0.73.0",
32
32
  "@types/react-native-background-timer": "^2.0.0",
33
33
  "base-64": "^1.0.0",
34
34
  "react-native-url-polyfill": "^1.1.2"
@@ -69,6 +69,7 @@ export type DailyEvent =
69
69
  | 'active-speaker-change'
70
70
  | 'network-quality-change'
71
71
  | 'network-connection'
72
+ | 'test-completed'
72
73
  | 'cpu-load-change'
73
74
  | 'error'
74
75
  | 'nonfatal-error'
@@ -90,6 +91,7 @@ export type DailyEvent =
90
91
  | 'local-audio-level'
91
92
  | 'remote-participants-audio-level'
92
93
  | 'dialin-connected'
94
+ | 'dialin-ready'
93
95
  | 'dialin-error'
94
96
  | 'dialin-stopped'
95
97
  | 'dialin-warning'
@@ -206,6 +208,9 @@ export interface DailyAdvancedConfig {
206
208
  * @deprecated This property will be removed. Instead, use sendSettings, which is found in DailyCallOptions.
207
209
  */
208
210
  camSimulcastEncodings?: CamSimulcastEncoding[];
211
+ /**
212
+ * @deprecated This property will be removed. All calls use v2CamAndMic.
213
+ */
209
214
  v2CamAndMic?: boolean;
210
215
  micAudioMode?: 'music' | 'speech';
211
216
  userMediaAudioConstraints?: MediaTrackConstraints;
@@ -423,6 +428,56 @@ export interface DailyStartScreenShare {
423
428
  | DailyScreenVideoSendSettingsPreset;
424
429
  }
425
430
 
431
+ export type DailyQualityTestResult =
432
+ | 'good'
433
+ | 'bad'
434
+ | 'warning'
435
+ | 'aborted'
436
+ | 'failed';
437
+
438
+ export type DailyP2PCallQualityTestResults =
439
+ | DailyP2PCallQualityTestStats
440
+ | DailyCallQualityTestAborted
441
+ | DailyCallQualityTestFailure;
442
+
443
+ export interface DailyP2PCallQualityTestStats {
444
+ result: Extract<DailyQualityTestResult, 'good' | 'warning' | 'bad'>;
445
+ data: DailyP2PCallQualityTestData;
446
+ secondsElapsed: number;
447
+ }
448
+
449
+ export interface DailyP2PCallQualityTestData {
450
+ maxRoundTripTime: number | null;
451
+ avgRoundTripTime: number | null;
452
+ avgRecvPacketLoss: number | null;
453
+ avgAvailableOutgoingBitrate: number | null;
454
+ avgSendBitsPerSecond: number | null;
455
+ avgRecvBitsPerSecond: number | null;
456
+ }
457
+
458
+ export interface DailyCallQualityTestAborted {
459
+ result: Extract<DailyQualityTestResult, 'aborted'>;
460
+ secondsElapsed: number;
461
+ }
462
+
463
+ export interface DailyCallQualityTestFailure {
464
+ result: Extract<DailyQualityTestResult, 'failed'>;
465
+ errorMsg: string;
466
+ error?: DailyFatalErrorObject<DailyFatalErrorType>;
467
+ secondsElapsed: number;
468
+ }
469
+
470
+ export interface DailyWebsocketConnectivityTestResults {
471
+ result: 'passed' | 'failed' | 'warning' | 'aborted';
472
+ abortedRegions: string[];
473
+ failedRegions: string[];
474
+ passedRegions: string[];
475
+ }
476
+
477
+ export interface DailyNetworkConnectivityTestStats {
478
+ result: 'passed' | 'failed' | 'aborted';
479
+ }
480
+
426
481
  export interface DailyNetworkStats {
427
482
  quality: number;
428
483
  stats: {
@@ -894,6 +949,15 @@ export interface DailyEventObjectNetworkConnectionEvent
894
949
  sfu_id?: string;
895
950
  }
896
951
 
952
+ export interface DailyEventObjectTestCompleted extends DailyEventObjectBase {
953
+ action: Extract<DailyEvent, 'test-completed'>;
954
+ test: 'p2p-call-quality' | 'network-connectivity' | 'websocket-connectivity';
955
+ results:
956
+ | DailyP2PCallQualityTestResults
957
+ | DailyNetworkConnectivityTestStats
958
+ | DailyWebsocketConnectivityTestResults;
959
+ }
960
+
897
961
  export interface DailyEventObjectActiveSpeakerChange
898
962
  extends DailyEventObjectBase {
899
963
  action: Extract<DailyEvent, 'active-speaker-change'>;
@@ -911,6 +975,7 @@ export interface DailyEventObjectAppMessage extends DailyEventObjectBase {
911
975
  export interface DailyEventObjectTranscriptionMessage
912
976
  extends DailyEventObjectBase {
913
977
  action: Extract<DailyEvent, 'transcription-message'>;
978
+ instanceId?: string;
914
979
  participantId: string;
915
980
  text: string;
916
981
  timestamp: Date;
@@ -969,6 +1034,7 @@ export interface DailyEventObjectLiveStreamingStopped
969
1034
  export interface DailyEventObjectTranscriptionStarted
970
1035
  extends DailyEventObjectBase {
971
1036
  action: Extract<DailyEvent, 'transcription-started'>;
1037
+ instanceId: string;
972
1038
  transcriptId?: string;
973
1039
  language: string;
974
1040
  model: string;
@@ -985,12 +1051,14 @@ export interface DailyEventObjectTranscriptionStarted
985
1051
  export interface DailyEventObjectTranscriptionStopped
986
1052
  extends DailyEventObjectBase {
987
1053
  action: Extract<DailyEvent, 'transcription-stopped'>;
1054
+ instanceId: string;
988
1055
  updatedBy: string;
989
1056
  }
990
1057
 
991
1058
  export interface DailyEventObjectTranscriptionError
992
1059
  extends DailyEventObjectBase {
993
1060
  action: Extract<DailyEvent, 'transcription-error'>;
1061
+ instanceId: string;
994
1062
  errorMsg?: string;
995
1063
  }
996
1064
  export interface DailyEventObjectRemoteMediaPlayerUpdate
@@ -1013,6 +1081,8 @@ export interface DailyEventObjectRemoteMediaPlayerStopped
1013
1081
  }
1014
1082
  export interface DailyEventObjectDialinConnected extends DailyEventObjectBase {
1015
1083
  action: Extract<DailyEvent, 'dialin-connected'>;
1084
+ sipHeaders?: Record<string, any>;
1085
+ sipFrom?: string;
1016
1086
  actionTraceId?: string;
1017
1087
  }
1018
1088
 
@@ -1024,6 +1094,8 @@ export interface DailyEventObjectDialinError extends DailyEventObjectBase {
1024
1094
 
1025
1095
  export interface DailyEventObjectDialinStopped extends DailyEventObjectBase {
1026
1096
  action: Extract<DailyEvent, 'dialin-stopped'>;
1097
+ sipHeaders?: Record<string, any>;
1098
+ sipFrom?: string;
1027
1099
  actionTraceId?: string;
1028
1100
  }
1029
1101
 
@@ -1036,6 +1108,7 @@ export interface DailyEventObjectDialinWarning extends DailyEventObjectBase {
1036
1108
  export interface DailyEventObjectDialOutConnected extends DailyEventObjectBase {
1037
1109
  action: Extract<DailyEvent, 'dialout-connected'>;
1038
1110
  sessionId?: string;
1111
+ userId?: string;
1039
1112
  actionTraceId?: string;
1040
1113
  }
1041
1114
 
@@ -1043,12 +1116,14 @@ export interface DailyEventObjectDialOutError extends DailyEventObjectBase {
1043
1116
  action: Extract<DailyEvent, 'dialout-error'>;
1044
1117
  errorMsg: string;
1045
1118
  sessionId?: string;
1119
+ userId?: string;
1046
1120
  actionTraceId?: string;
1047
1121
  }
1048
1122
 
1049
1123
  export interface DailyEventObjectDialOutStopped extends DailyEventObjectBase {
1050
1124
  action: Extract<DailyEvent, 'dialout-stopped'>;
1051
1125
  sessionId?: string;
1126
+ userId?: string;
1052
1127
  actionTraceId?: string;
1053
1128
  }
1054
1129
 
@@ -1056,6 +1131,7 @@ export interface DailyEventObjectDialOutWarning extends DailyEventObjectBase {
1056
1131
  action: Extract<DailyEvent, 'dialout-warning'>;
1057
1132
  errorMsg: string;
1058
1133
  sessionId?: string;
1134
+ userId?: string;
1059
1135
  actionTraceId?: string;
1060
1136
  }
1061
1137
 
@@ -1120,6 +1196,8 @@ export type DailyEventObject<T extends DailyEvent = any> =
1120
1196
  ? DailyEventObjectCpuLoadEvent
1121
1197
  : T extends DailyEventObjectNetworkConnectionEvent['action']
1122
1198
  ? DailyEventObjectNetworkConnectionEvent
1199
+ : T extends DailyEventObjectTestCompleted['action']
1200
+ ? DailyEventObjectTestCompleted
1123
1201
  : T extends DailyEventObjectActiveSpeakerChange['action']
1124
1202
  ? DailyEventObjectActiveSpeakerChange
1125
1203
  : T extends DailyEventObjectReceiveSettingsUpdated['action']
@@ -1353,6 +1431,17 @@ export interface DailyTranscriptionDeepgramOptions {
1353
1431
  punctuate?: boolean;
1354
1432
  extra?: Record<string, any>;
1355
1433
  includeRawResponse?: boolean;
1434
+ instanceId?: string;
1435
+ participants?: Array<string>;
1436
+ }
1437
+
1438
+ export interface DailyTranscriptionUpdateOptions {
1439
+ instanceId?: string;
1440
+ participants: Array<string>;
1441
+ }
1442
+
1443
+ export interface DailyTranscriptionStopOptions {
1444
+ instanceId?: string;
1356
1445
  }
1357
1446
 
1358
1447
  export type DailyDialOutAudioCodecs = 'PCMU' | 'OPUS' | 'G722' | 'PCMA';
@@ -1371,6 +1460,7 @@ export interface DailyDialOutSession {
1371
1460
  export interface DailyStartDialoutSipOptions {
1372
1461
  sipUri?: string;
1373
1462
  displayName?: string;
1463
+ userId?: string;
1374
1464
  video?: boolean;
1375
1465
  codecs?: DailyDialOutCodecs;
1376
1466
  }
@@ -1378,13 +1468,25 @@ export interface DailyStartDialoutSipOptions {
1378
1468
  export interface DailyStartDialoutPhoneOptions {
1379
1469
  phoneNumber?: string;
1380
1470
  displayName?: string;
1471
+ userId?: string;
1381
1472
  codecs?: DailyDialOutCodecs;
1473
+ callerId?: string;
1382
1474
  }
1383
1475
 
1384
1476
  export type DailyStartDialoutOptions =
1385
1477
  | DailyStartDialoutSipOptions
1386
1478
  | DailyStartDialoutPhoneOptions;
1387
1479
 
1480
+ export interface DailySipCallTransferOptions {
1481
+ sessionId: string;
1482
+ toEndPoint: string;
1483
+ }
1484
+
1485
+ export interface DailySipReferOptions {
1486
+ sessionId: string;
1487
+ toEndPoint: string;
1488
+ }
1489
+
1388
1490
  export interface DailyCall {
1389
1491
  callClientId: string;
1390
1492
  join(properties?: DailyCallOptions): Promise<DailyParticipantsObject | void>;
@@ -1480,11 +1582,23 @@ export interface DailyCall {
1480
1582
  options: DailyRemoteMediaPlayerUpdateOptions
1481
1583
  ): Promise<DailyRemoteMediaPlayerInfo>;
1482
1584
  startTranscription(options?: DailyTranscriptionDeepgramOptions): void;
1483
- stopTranscription(): void;
1585
+ updateTranscription(options: DailyTranscriptionUpdateOptions): void;
1586
+ stopTranscription(options?: DailyTranscriptionStopOptions): void;
1484
1587
  preAuth(properties?: DailyCallOptions): Promise<{ access: DailyAccess }>;
1485
1588
  load(properties?: DailyLoadOptions): Promise<void>;
1486
1589
  startScreenShare(properties?: DailyStartScreenShare): void;
1487
1590
  stopScreenShare(): void;
1591
+ testPeerToPeerCallQuality(options: {
1592
+ videoTrack: MediaStreamTrack;
1593
+ duration?: number;
1594
+ }): Promise<DailyP2PCallQualityTestResults>;
1595
+ stopTestPeerToPeerCallQuality(): void;
1596
+ testWebsocketConnectivity(): Promise<DailyWebsocketConnectivityTestResults>;
1597
+ abortTestWebsocketConnectivity(): void;
1598
+ testNetworkConnectivity(
1599
+ videoTrack: MediaStreamTrack
1600
+ ): Promise<DailyNetworkConnectivityTestStats>;
1601
+ abortTestNetworkConnectivity(): void;
1488
1602
  getNetworkStats(): Promise<DailyNetworkStats>;
1489
1603
  getCpuLoadStats(): Promise<DailyCpuLoadStats>;
1490
1604
  updateSendSettings(settings: DailySendSettings): Promise<DailySendSettings>;
@@ -1527,6 +1641,8 @@ export interface DailyCall {
1527
1641
  ): Promise<{ session?: DailyDialOutSession }>;
1528
1642
  stopDialOut(options: { sessionId: string }): Promise<void>;
1529
1643
  sendDTMF(options: { sessionId: string; tones: string }): Promise<void>;
1644
+ sipCallTransfer(options: DailySipCallTransferOptions): Promise<void>;
1645
+ sipRefer(options: DailySipReferOptions): Promise<void>;
1530
1646
  }
1531
1647
 
1532
1648
  declare const Daily: DailyCallFactory & DailyCallStaticUtils;