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.
- package/README.md +39 -6
- package/TiRtcReactNative.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcModule.kt +140 -17
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeCleanup.kt +54 -19
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeCloudStorageCallbacks.kt +60 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeEventBinder.kt +2 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeEventSink.kt +20 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeMaps.kt +112 -5
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeOptions.kt +2 -7
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeRegistry.kt +3 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeStorageSupport.kt +46 -22
- package/ios/TiRtcReactNative+Conn.mm +61 -0
- package/ios/TiRtcReactNative+Output.mm +1 -7
- package/ios/TiRtcReactNative+Private.h +1 -0
- package/ios/TiRtcReactNative+Storage.mm +133 -35
- package/ios/TiRtcReactNative.mm +142 -51
- package/ios/TiRtcReactNativeCloudStorageCallbacks.h +13 -0
- package/ios/TiRtcReactNativeCloudStorageCallbacks.mm +67 -0
- package/ios/TiRtcReactNativeEventBinder.h +4 -0
- package/ios/TiRtcReactNativeEventBinder.mm +11 -0
- package/ios/TiRtcReactNativeEventSink.h +5 -0
- package/ios/TiRtcReactNativeEventSink.mm +18 -0
- package/ios/TiRtcReactNativeMaps.h +6 -0
- package/ios/TiRtcReactNativeMaps.mm +47 -0
- package/ios/TiRtcReactNativeOptions.mm +2 -6
- package/lib/module/audio_input.js +23 -4
- package/lib/module/audio_input.js.map +1 -1
- package/lib/module/build_identity.js +1 -0
- package/lib/module/conn.js +19 -0
- package/lib/module/conn.js.map +1 -1
- package/lib/module/events.js +16 -9
- package/lib/module/events.js.map +1 -1
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/logging_internal.js +16 -0
- package/lib/module/logging_internal.js.map +1 -1
- package/lib/module/raw_dump.js +53 -0
- package/lib/module/raw_dump.js.map +1 -0
- package/lib/module/runtime.js +3 -1
- package/lib/module/runtime.js.map +1 -1
- package/lib/module/specs/NativeTiRtc.js.map +1 -1
- package/lib/module/storage.js +190 -33
- package/lib/module/storage.js.map +1 -1
- package/lib/module/types.js +0 -4
- package/lib/module/types.js.map +1 -1
- package/lib/module/video_input.js +16 -6
- package/lib/module/video_input.js.map +1 -1
- package/lib/typescript/build_identity.d.ts +6 -0
- package/lib/typescript/conn.d.ts +2 -0
- package/lib/typescript/index.d.ts +5 -3
- package/lib/typescript/logging_internal.d.ts +1 -0
- package/lib/typescript/native.d.ts +1 -1
- package/lib/typescript/raw_dump.d.ts +35 -0
- package/lib/typescript/specs/NativeTiRtc.d.ts +75 -3
- package/lib/typescript/storage.d.ts +84 -3
- package/lib/typescript/types.d.ts +5 -6
- package/package.json +3 -3
- package/src/audio_input.ts +30 -11
- package/src/build_identity.ts +6 -0
- package/src/conn.ts +23 -0
- package/src/events.ts +14 -9
- package/src/index.ts +19 -1
- package/src/logging_internal.ts +18 -0
- package/src/native.ts +7 -1
- package/src/raw_dump.ts +84 -0
- package/src/runtime.ts +2 -1
- package/src/specs/NativeTiRtc.ts +80 -3
- package/src/storage.ts +260 -39
- package/src/types.ts +5 -8
- package/src/video_input.ts +22 -12
package/src/video_input.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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> {
|