tirtc-react-native 2.4.2 → 2.5.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.
Files changed (71) hide show
  1. package/README.md +39 -6
  2. package/TiRtcReactNative.podspec +1 -1
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcModule.kt +140 -17
  5. package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeCleanup.kt +54 -19
  6. package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeCloudStorageCallbacks.kt +60 -0
  7. package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeEventBinder.kt +2 -0
  8. package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeEventSink.kt +20 -0
  9. package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeMaps.kt +112 -5
  10. package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeOptions.kt +2 -7
  11. package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeRegistry.kt +3 -0
  12. package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeStorageSupport.kt +46 -22
  13. package/ios/TiRtcReactNative+Conn.mm +61 -0
  14. package/ios/TiRtcReactNative+Output.mm +1 -7
  15. package/ios/TiRtcReactNative+Private.h +1 -0
  16. package/ios/TiRtcReactNative+Storage.mm +133 -35
  17. package/ios/TiRtcReactNative.mm +142 -51
  18. package/ios/TiRtcReactNativeCloudStorageCallbacks.h +13 -0
  19. package/ios/TiRtcReactNativeCloudStorageCallbacks.mm +67 -0
  20. package/ios/TiRtcReactNativeEventBinder.h +4 -0
  21. package/ios/TiRtcReactNativeEventBinder.mm +11 -0
  22. package/ios/TiRtcReactNativeEventSink.h +5 -0
  23. package/ios/TiRtcReactNativeEventSink.mm +18 -0
  24. package/ios/TiRtcReactNativeMaps.h +6 -0
  25. package/ios/TiRtcReactNativeMaps.mm +47 -0
  26. package/ios/TiRtcReactNativeOptions.mm +2 -6
  27. package/lib/module/audio_input.js +23 -4
  28. package/lib/module/audio_input.js.map +1 -1
  29. package/lib/module/build_identity.js +1 -0
  30. package/lib/module/conn.js +19 -0
  31. package/lib/module/conn.js.map +1 -1
  32. package/lib/module/events.js +16 -9
  33. package/lib/module/events.js.map +1 -1
  34. package/lib/module/index.js +3 -2
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/module/logging_internal.js +16 -0
  37. package/lib/module/logging_internal.js.map +1 -1
  38. package/lib/module/raw_dump.js +53 -0
  39. package/lib/module/raw_dump.js.map +1 -0
  40. package/lib/module/runtime.js +3 -1
  41. package/lib/module/runtime.js.map +1 -1
  42. package/lib/module/specs/NativeTiRtc.js.map +1 -1
  43. package/lib/module/storage.js +190 -33
  44. package/lib/module/storage.js.map +1 -1
  45. package/lib/module/types.js +0 -4
  46. package/lib/module/types.js.map +1 -1
  47. package/lib/module/video_input.js +16 -6
  48. package/lib/module/video_input.js.map +1 -1
  49. package/lib/typescript/build_identity.d.ts +6 -0
  50. package/lib/typescript/conn.d.ts +2 -0
  51. package/lib/typescript/index.d.ts +5 -3
  52. package/lib/typescript/logging_internal.d.ts +1 -0
  53. package/lib/typescript/native.d.ts +1 -1
  54. package/lib/typescript/raw_dump.d.ts +35 -0
  55. package/lib/typescript/specs/NativeTiRtc.d.ts +75 -3
  56. package/lib/typescript/storage.d.ts +84 -3
  57. package/lib/typescript/types.d.ts +5 -6
  58. package/package.json +3 -3
  59. package/src/audio_input.ts +30 -11
  60. package/src/build_identity.ts +6 -0
  61. package/src/conn.ts +23 -0
  62. package/src/events.ts +14 -9
  63. package/src/index.ts +19 -1
  64. package/src/logging_internal.ts +18 -0
  65. package/src/native.ts +7 -1
  66. package/src/raw_dump.ts +84 -0
  67. package/src/runtime.ts +2 -1
  68. package/src/specs/NativeTiRtc.ts +80 -3
  69. package/src/storage.ts +260 -39
  70. package/src/types.ts +5 -8
  71. package/src/video_input.ts +22 -12
@@ -43,7 +43,7 @@ export class TiRtcVideoInput {
43
43
  private currentOutputSize: TiRtcSize | null = null;
44
44
  private currentOutputFps: number | null = null;
45
45
  private options: Required<TiRtcVideoInputOptions> = {
46
- codec: 'h264',
46
+ media: 66,
47
47
  width: 640,
48
48
  height: 480,
49
49
  frameRate: 'fps15',
@@ -92,7 +92,7 @@ export class TiRtcVideoInput {
92
92
  return Promise.resolve(TIRTC_ERROR_INVALID_ARGUMENT);
93
93
  }
94
94
  const normalized = {
95
- codec: options.codec ?? 'h264',
95
+ media: options.media === undefined ? 66 : options.media,
96
96
  width: options.width ?? 640,
97
97
  height: options.height ?? 480,
98
98
  frameRate: options.frameRate ?? 'fps15',
@@ -100,12 +100,16 @@ export class TiRtcVideoInput {
100
100
  cameraFacing: options.cameraFacing ?? 'front',
101
101
  };
102
102
  if (
103
+ !Number.isInteger(normalized.media) ||
104
+ ![65, 66].includes(normalized.media) ||
103
105
  !isPositiveInt32Size(normalized.width) ||
104
106
  !isPositiveInt32Size(normalized.height) ||
105
107
  !Number.isSafeInteger(normalized.bitrateKbps) ||
106
108
  normalized.bitrateKbps < 0 ||
107
109
  normalized.bitrateKbps > 4294967295
108
110
  ) {
111
+ logRtcOutcome('video_input_set_options', TIRTC_ERROR_INVALID_ARGUMENT,
112
+ ` nano_media=${typeof normalized.media === 'number' ? normalized.media : typeof normalized.media}`);
109
113
  return Promise.resolve(TIRTC_ERROR_INVALID_ARGUMENT);
110
114
  }
111
115
  return this.enqueue(async () => {
@@ -114,6 +118,8 @@ export class TiRtcVideoInput {
114
118
  return identity;
115
119
  }
116
120
  const code = await NativeTiRtc.videoInputSetOptions(identity.objectId, normalized);
121
+ logRtcOutcome('video_input_set_options', code,
122
+ ` nano_media=${normalized.media} width=${normalized.width} height=${normalized.height} fps=${['fps10', 'fps15', 'fps30'].includes(normalized.frameRate) ? normalized.frameRate : 'invalid'}`);
117
123
  if (code === TIRTC_ERROR_OK) {
118
124
  this.options = normalized;
119
125
  }
@@ -122,16 +128,20 @@ export class TiRtcVideoInput {
122
128
  }
123
129
 
124
130
  start(): Promise<number> {
125
- return this.logged(
126
- 'video_input_start',
127
- this.enqueue(async () => {
128
- const identity = this.ensureIdentity();
129
- if (typeof identity === 'number') {
130
- return identity;
131
- }
132
- return NativeTiRtc.videoInputStart(identity.objectId);
133
- }),
134
- );
131
+ return this.enqueue(async () => {
132
+ const identity = this.ensureIdentity();
133
+ if (typeof identity === 'number') {
134
+ logRtcOutcome('video_input_start', identity);
135
+ return identity;
136
+ }
137
+ const wasRunning = this.state === 'running';
138
+ const code = await NativeTiRtc.videoInputStart(identity.objectId);
139
+ if (code !== TIRTC_ERROR_OK || !wasRunning) {
140
+ logRtcOutcome('video_input_start', code,
141
+ ` object_id=${identity.objectId} nano_media=${this.options.media} width=${this.options.width} height=${this.options.height} fps=${this.options.frameRate}`);
142
+ }
143
+ return code;
144
+ });
135
145
  }
136
146
 
137
147
  attach(connection: TiRtcConn, streamId: number): Promise<number> {