tirtc-react-native 2.2.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/LICENSE +11 -0
- package/README.md +140 -0
- package/TiRtcReactNative.podspec +35 -0
- package/android/build.gradle +37 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcModule.kt +482 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcPackage.kt +43 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeErrors.kt +32 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeEventBinder.kt +99 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeEventSink.kt +168 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeMaps.kt +49 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeMetricsMaps.kt +173 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeModuleSupport.kt +91 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeOptions.kt +127 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeRegistry.kt +71 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcVideoInputPreviewManager.kt +109 -0
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcVideoOutputViewManager.kt +109 -0
- package/ios/TiRtcReactNative+Conn.mm +112 -0
- package/ios/TiRtcReactNative+Input.mm +196 -0
- package/ios/TiRtcReactNative+Output.mm +172 -0
- package/ios/TiRtcReactNative+Private.h +28 -0
- package/ios/TiRtcReactNative.h +6 -0
- package/ios/TiRtcReactNative.mm +189 -0
- package/ios/TiRtcReactNativeErrors.h +18 -0
- package/ios/TiRtcReactNativeErrors.mm +105 -0
- package/ios/TiRtcReactNativeEventBinder.h +19 -0
- package/ios/TiRtcReactNativeEventBinder.mm +226 -0
- package/ios/TiRtcReactNativeEventSink.h +29 -0
- package/ios/TiRtcReactNativeEventSink.mm +125 -0
- package/ios/TiRtcReactNativeMaps.h +21 -0
- package/ios/TiRtcReactNativeMaps.mm +249 -0
- package/ios/TiRtcReactNativeNative.h +8 -0
- package/ios/TiRtcReactNativeOptions.h +11 -0
- package/ios/TiRtcReactNativeOptions.mm +123 -0
- package/ios/TiRtcReactNativeRegistry.h +20 -0
- package/ios/TiRtcReactNativeRegistry.mm +119 -0
- package/ios/TiRtcVideoInputPreview.h +5 -0
- package/ios/TiRtcVideoInputPreview.mm +149 -0
- package/ios/TiRtcVideoOutputView.h +5 -0
- package/ios/TiRtcVideoOutputView.mm +149 -0
- package/lib/module/audio_input.js +177 -0
- package/lib/module/audio_input.js.map +1 -0
- package/lib/module/audio_output.js +168 -0
- package/lib/module/audio_output.js.map +1 -0
- package/lib/module/conn.js +174 -0
- package/lib/module/conn.js.map +1 -0
- package/lib/module/errors.js +63 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/events.js +37 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/logging.js +26 -0
- package/lib/module/logging.js.map +1 -0
- package/lib/module/native.js +5 -0
- package/lib/module/native.js.map +1 -0
- package/lib/module/native_object_id.js +47 -0
- package/lib/module/native_object_id.js.map +1 -0
- package/lib/module/runtime.js +27 -0
- package/lib/module/runtime.js.map +1 -0
- package/lib/module/specs/NativeTiRtc.js +3 -0
- package/lib/module/specs/NativeTiRtc.js.map +1 -0
- package/lib/module/specs/TiRtcVideoInputPreviewNativeComponent.js +24 -0
- package/lib/module/specs/TiRtcVideoOutputViewNativeComponent.js +24 -0
- package/lib/module/types.js +93 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/video_input.js +266 -0
- package/lib/module/video_input.js.map +1 -0
- package/lib/module/video_output.js +224 -0
- package/lib/module/video_output.js.map +1 -0
- package/lib/typescript/audio_input.d.ts +25 -0
- package/lib/typescript/audio_output.d.ts +25 -0
- package/lib/typescript/conn.d.ts +28 -0
- package/lib/typescript/errors.d.ts +19 -0
- package/lib/typescript/events.d.ts +6 -0
- package/lib/typescript/index.d.ts +9 -0
- package/lib/typescript/logging.d.ts +9 -0
- package/lib/typescript/native.d.ts +5 -0
- package/lib/typescript/native_object_id.d.ts +12 -0
- package/lib/typescript/runtime.d.ts +8 -0
- package/lib/typescript/specs/NativeTiRtc.d.ts +223 -0
- package/lib/typescript/specs/TiRtcVideoInputPreviewNativeComponent.d.ts +8 -0
- package/lib/typescript/specs/TiRtcVideoOutputViewNativeComponent.d.ts +8 -0
- package/lib/typescript/types.d.ts +281 -0
- package/lib/typescript/video_input.d.ts +50 -0
- package/lib/typescript/video_output.d.ts +46 -0
- package/package.json +80 -0
- package/react-native.config.js +10 -0
- package/src/audio_input.ts +205 -0
- package/src/audio_output.ts +202 -0
- package/src/conn.ts +222 -0
- package/src/errors.ts +81 -0
- package/src/events.ts +44 -0
- package/src/index.ts +61 -0
- package/src/logging.ts +33 -0
- package/src/native.ts +6 -0
- package/src/native_object_id.ts +63 -0
- package/src/runtime.ts +32 -0
- package/src/specs/NativeTiRtc.ts +256 -0
- package/src/specs/TiRtcVideoInputPreviewNativeComponent.ts +14 -0
- package/src/specs/TiRtcVideoOutputViewNativeComponent.ts +12 -0
- package/src/types.ts +340 -0
- package/src/video_input.ts +314 -0
- package/src/video_output.ts +273 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { isPositiveInt32, isUInt8, normalizeCreateResult, returnReleasedIfDisposed, TIRTC_ERROR_INVALID_ARGUMENT, TIRTC_ERROR_OK, } from './errors';
|
|
4
|
+
import { registerNativeEventHandler, unregisterNativeEventHandler } from './events';
|
|
5
|
+
import { clearNativeIdentity, readNativeIdentity, setNativeIdentity, subscribeNativeIdentity, } from './native_object_id';
|
|
6
|
+
import { NativeTiRtc, NativeTiRtcVideoOutputView } from './native';
|
|
7
|
+
export class TiRtcVideoOutput {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.identity = null;
|
|
10
|
+
this.disposed = false;
|
|
11
|
+
this.createCode = TIRTC_ERROR_OK;
|
|
12
|
+
this.currentState = 'idle';
|
|
13
|
+
this.currentRenderSize = null;
|
|
14
|
+
this.options = {
|
|
15
|
+
decoderPreference: 'auto',
|
|
16
|
+
bufferStrategy: 'automatic',
|
|
17
|
+
maxBufferWatermarkMs: undefined,
|
|
18
|
+
};
|
|
19
|
+
this.onStateChanged = null;
|
|
20
|
+
this.onRenderSizeChanged = null;
|
|
21
|
+
this.onError = null;
|
|
22
|
+
const result = normalizeCreateResult(NativeTiRtc.createVideoOutput());
|
|
23
|
+
this.createCode = result.code;
|
|
24
|
+
if (result.code === TIRTC_ERROR_OK) {
|
|
25
|
+
this.adoptIdentity({ objectId: result.objectId, generation: result.generation });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
get state() {
|
|
29
|
+
if (this.identity !== null && !this.disposed) {
|
|
30
|
+
const result = NativeTiRtc.videoOutputGetState(this.identity.objectId);
|
|
31
|
+
if (result.state !== null) {
|
|
32
|
+
this.currentState = result.state;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return this.currentState;
|
|
36
|
+
}
|
|
37
|
+
get renderSize() {
|
|
38
|
+
if (this.identity !== null && !this.disposed) {
|
|
39
|
+
this.currentRenderSize = NativeTiRtc.videoOutputGetRenderSize(this.identity.objectId).size;
|
|
40
|
+
}
|
|
41
|
+
return this.currentRenderSize;
|
|
42
|
+
}
|
|
43
|
+
setOptions(options) {
|
|
44
|
+
const normalized = {
|
|
45
|
+
decoderPreference: options.decoderPreference ?? 'auto',
|
|
46
|
+
bufferStrategy: options.bufferStrategy ?? 'automatic',
|
|
47
|
+
maxBufferWatermarkMs: options.maxBufferWatermarkMs,
|
|
48
|
+
};
|
|
49
|
+
if (normalized.maxBufferWatermarkMs !== undefined
|
|
50
|
+
&& !isPositiveInt32(normalized.maxBufferWatermarkMs)) {
|
|
51
|
+
return TIRTC_ERROR_INVALID_ARGUMENT;
|
|
52
|
+
}
|
|
53
|
+
const identity = this.ensureIdentity();
|
|
54
|
+
if (typeof identity === 'number') {
|
|
55
|
+
return identity;
|
|
56
|
+
}
|
|
57
|
+
const code = NativeTiRtc.videoOutputSetOptions(identity.objectId, {
|
|
58
|
+
...normalized,
|
|
59
|
+
maxBufferWatermarkMs: normalized.maxBufferWatermarkMs ?? null,
|
|
60
|
+
});
|
|
61
|
+
if (code === TIRTC_ERROR_OK) {
|
|
62
|
+
this.options = normalized;
|
|
63
|
+
}
|
|
64
|
+
return code;
|
|
65
|
+
}
|
|
66
|
+
attach(connection, streamId) {
|
|
67
|
+
const connIdentity = readNativeIdentity(connection);
|
|
68
|
+
if (!isUInt8(streamId)) {
|
|
69
|
+
return TIRTC_ERROR_INVALID_ARGUMENT;
|
|
70
|
+
}
|
|
71
|
+
if (connIdentity === null) {
|
|
72
|
+
return TIRTC_ERROR_INVALID_ARGUMENT;
|
|
73
|
+
}
|
|
74
|
+
const identity = this.ensureIdentity();
|
|
75
|
+
if (typeof identity === 'number') {
|
|
76
|
+
return identity;
|
|
77
|
+
}
|
|
78
|
+
return NativeTiRtc.videoOutputAttach(identity.objectId, connIdentity.objectId, streamId);
|
|
79
|
+
}
|
|
80
|
+
detach() {
|
|
81
|
+
const released = returnReleasedIfDisposed(this.disposed);
|
|
82
|
+
if (released !== null) {
|
|
83
|
+
return released;
|
|
84
|
+
}
|
|
85
|
+
return this.identity === null ? TIRTC_ERROR_OK : NativeTiRtc.videoOutputDetach(this.identity.objectId);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Creates a React element bound to this output owner.
|
|
89
|
+
*
|
|
90
|
+
* The returned element renders a placeholder until this output has a live
|
|
91
|
+
* native identity. Attach the output to a connection before expecting remote
|
|
92
|
+
* frames, and dispose the output when the render surface is no longer needed.
|
|
93
|
+
*/
|
|
94
|
+
view(props = {}) {
|
|
95
|
+
return React.createElement(TiRtcVideoOutputView, {
|
|
96
|
+
...props,
|
|
97
|
+
output: this,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
getMetricsSnapshot() {
|
|
101
|
+
const identity = this.ensureIdentity();
|
|
102
|
+
if (typeof identity === 'number') {
|
|
103
|
+
return { code: identity, snapshot: null };
|
|
104
|
+
}
|
|
105
|
+
return NativeTiRtc.videoOutputGetMetricsSnapshot(identity.objectId);
|
|
106
|
+
}
|
|
107
|
+
resetMetricsSession() {
|
|
108
|
+
const identity = this.ensureIdentity();
|
|
109
|
+
if (typeof identity === 'number') {
|
|
110
|
+
return identity;
|
|
111
|
+
}
|
|
112
|
+
return NativeTiRtc.videoOutputResetMetricsSession(identity.objectId);
|
|
113
|
+
}
|
|
114
|
+
getDebugSnapshot() {
|
|
115
|
+
const identity = this.ensureIdentity();
|
|
116
|
+
if (typeof identity === 'number') {
|
|
117
|
+
return { code: identity, snapshot: null };
|
|
118
|
+
}
|
|
119
|
+
return NativeTiRtc.videoOutputGetDebugSnapshot(identity.objectId);
|
|
120
|
+
}
|
|
121
|
+
dispose() {
|
|
122
|
+
if (this.disposed) {
|
|
123
|
+
return TIRTC_ERROR_OK;
|
|
124
|
+
}
|
|
125
|
+
if (this.identity === null) {
|
|
126
|
+
this.disposed = true;
|
|
127
|
+
this.clearCallbacks();
|
|
128
|
+
this.currentState = 'idle';
|
|
129
|
+
this.currentRenderSize = null;
|
|
130
|
+
return TIRTC_ERROR_OK;
|
|
131
|
+
}
|
|
132
|
+
const identity = this.identity;
|
|
133
|
+
const code = NativeTiRtc.videoOutputDispose(identity.objectId);
|
|
134
|
+
if (code === TIRTC_ERROR_OK) {
|
|
135
|
+
this.disposed = true;
|
|
136
|
+
this.identity = null;
|
|
137
|
+
unregisterNativeEventHandler(identity);
|
|
138
|
+
clearNativeIdentity(this);
|
|
139
|
+
this.clearCallbacks();
|
|
140
|
+
this.currentState = 'idle';
|
|
141
|
+
this.currentRenderSize = null;
|
|
142
|
+
}
|
|
143
|
+
return code;
|
|
144
|
+
}
|
|
145
|
+
ensureIdentity() {
|
|
146
|
+
const released = returnReleasedIfDisposed(this.disposed);
|
|
147
|
+
if (released !== null) {
|
|
148
|
+
return released;
|
|
149
|
+
}
|
|
150
|
+
if (this.identity !== null) {
|
|
151
|
+
return this.identity;
|
|
152
|
+
}
|
|
153
|
+
return this.createCode;
|
|
154
|
+
}
|
|
155
|
+
adoptIdentity(identity) {
|
|
156
|
+
this.identity = identity;
|
|
157
|
+
setNativeIdentity(this, identity);
|
|
158
|
+
registerNativeEventHandler(identity, (event) => this.handleEvent(event));
|
|
159
|
+
NativeTiRtc.videoOutputSetOptions(identity.objectId, {
|
|
160
|
+
...this.options,
|
|
161
|
+
maxBufferWatermarkMs: this.options.maxBufferWatermarkMs ?? null,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
clearCallbacks() {
|
|
165
|
+
this.onStateChanged = null;
|
|
166
|
+
this.onRenderSizeChanged = null;
|
|
167
|
+
this.onError = null;
|
|
168
|
+
}
|
|
169
|
+
handleEvent(event) {
|
|
170
|
+
if (this.disposed) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
switch (event.type) {
|
|
174
|
+
case 'videoOutputStateChanged':
|
|
175
|
+
if (event.state !== undefined) {
|
|
176
|
+
this.currentState = event.state;
|
|
177
|
+
this.onStateChanged?.(this.currentState);
|
|
178
|
+
}
|
|
179
|
+
break;
|
|
180
|
+
case 'videoOutputRenderSizeChanged':
|
|
181
|
+
if (event.size !== undefined) {
|
|
182
|
+
this.currentRenderSize = event.size;
|
|
183
|
+
this.onRenderSizeChanged?.(event.size);
|
|
184
|
+
}
|
|
185
|
+
break;
|
|
186
|
+
case 'videoOutputError':
|
|
187
|
+
this.onError?.(event.code ?? TIRTC_ERROR_INVALID_ARGUMENT);
|
|
188
|
+
break;
|
|
189
|
+
default:
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Renders the remote video stream attached to a `TiRtcVideoOutput`.
|
|
196
|
+
*
|
|
197
|
+
* The component observes the owner identity and never accepts raw native ids.
|
|
198
|
+
* If the owner is not created, has been disposed, or is not a `TiRtcVideoOutput`,
|
|
199
|
+
* it renders a regular `View` with the remaining props.
|
|
200
|
+
*/
|
|
201
|
+
export function TiRtcVideoOutputView(props) {
|
|
202
|
+
const { output, resizeMode = 'contain', ...viewProps } = props;
|
|
203
|
+
const identity = useOwnerIdentity(output instanceof TiRtcVideoOutput ? output : null);
|
|
204
|
+
if (identity === null) {
|
|
205
|
+
return React.createElement(View, viewProps);
|
|
206
|
+
}
|
|
207
|
+
return React.createElement(NativeTiRtcVideoOutputView, {
|
|
208
|
+
...viewProps,
|
|
209
|
+
nativeObjectId: identity.objectId,
|
|
210
|
+
generation: identity.generation,
|
|
211
|
+
resizeMode,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function useOwnerIdentity(owner) {
|
|
215
|
+
const [, forceUpdate] = React.useReducer((value) => value + 1, 0);
|
|
216
|
+
React.useEffect(() => {
|
|
217
|
+
if (owner === null) {
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
return subscribeNativeIdentity(owner, forceUpdate);
|
|
221
|
+
}, [owner]);
|
|
222
|
+
return owner === null ? null : readNativeIdentity(owner);
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=video_output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video_output.js","sourceRoot":"","sources":["../../src/video_output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EACL,eAAe,EACf,OAAO,EACP,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,EA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AC,KAAoB;IAC5C,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,uBAAuB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACrD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TiRtcConn } from './conn';
|
|
2
|
+
import type { TiRtcAudioInputOptions, TiRtcInputState, TiRtcOnInputError, TiRtcOnInputStateChanged } from './types';
|
|
3
|
+
export declare class TiRtcAudioInput {
|
|
4
|
+
private identity;
|
|
5
|
+
private disposed;
|
|
6
|
+
private createCode;
|
|
7
|
+
private queue;
|
|
8
|
+
private currentState;
|
|
9
|
+
private options;
|
|
10
|
+
onStateChanged: TiRtcOnInputStateChanged | null;
|
|
11
|
+
onError: TiRtcOnInputError | null;
|
|
12
|
+
constructor();
|
|
13
|
+
get state(): TiRtcInputState;
|
|
14
|
+
setOptions(options: TiRtcAudioInputOptions): Promise<number>;
|
|
15
|
+
attach(connection: TiRtcConn, streamId: number): Promise<number>;
|
|
16
|
+
start(): Promise<number>;
|
|
17
|
+
stop(): Promise<number>;
|
|
18
|
+
detach(connection: TiRtcConn): Promise<number>;
|
|
19
|
+
dispose(): Promise<number>;
|
|
20
|
+
private enqueue;
|
|
21
|
+
private ensureIdentity;
|
|
22
|
+
private adoptIdentity;
|
|
23
|
+
private clearCallbacks;
|
|
24
|
+
private handleEvent;
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TiRtcConn } from './conn';
|
|
2
|
+
import type { TiRtcAudioOutputDebugSnapshotResult, TiRtcAudioOutputMetricsResult, TiRtcAudioOutputOptions, TiRtcAudioOutputState, TiRtcOnAudioOutputError, TiRtcOnAudioOutputStateChanged } from './types';
|
|
3
|
+
export declare class TiRtcAudioOutput {
|
|
4
|
+
private identity;
|
|
5
|
+
private disposed;
|
|
6
|
+
private createCode;
|
|
7
|
+
private currentState;
|
|
8
|
+
private options;
|
|
9
|
+
onStateChanged: TiRtcOnAudioOutputStateChanged | null;
|
|
10
|
+
onError: TiRtcOnAudioOutputError | null;
|
|
11
|
+
constructor();
|
|
12
|
+
get state(): TiRtcAudioOutputState;
|
|
13
|
+
configure(options: TiRtcAudioOutputOptions): number;
|
|
14
|
+
attach(connection: TiRtcConn, streamId: number): number;
|
|
15
|
+
detach(): number;
|
|
16
|
+
setVolume(volumePercent: number): number;
|
|
17
|
+
getMetricsSnapshot(): TiRtcAudioOutputMetricsResult;
|
|
18
|
+
resetMetricsSession(): number;
|
|
19
|
+
getDebugSnapshot(): TiRtcAudioOutputDebugSnapshotResult;
|
|
20
|
+
dispose(): number;
|
|
21
|
+
private ensureIdentity;
|
|
22
|
+
private adoptIdentity;
|
|
23
|
+
private clearCallbacks;
|
|
24
|
+
private handleEvent;
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TiRtcConnMetricsResult, TiRtcConnState, TiRtcOnConnCommand, TiRtcOnConnStateChanged, TiRtcOnConnStreamMessage } from './types';
|
|
2
|
+
export declare class TiRtcConn {
|
|
3
|
+
private identity;
|
|
4
|
+
private disposed;
|
|
5
|
+
private createCode;
|
|
6
|
+
private currentState;
|
|
7
|
+
constructor();
|
|
8
|
+
onStateChanged: TiRtcOnConnStateChanged | null;
|
|
9
|
+
onCommand: TiRtcOnConnCommand | null;
|
|
10
|
+
onStreamMessage: TiRtcOnConnStreamMessage | null;
|
|
11
|
+
get state(): TiRtcConnState;
|
|
12
|
+
connect(remoteId: string, token: string): number;
|
|
13
|
+
disconnect(): number;
|
|
14
|
+
sendCommand(commandId: number, data: Uint8Array): number;
|
|
15
|
+
sendStreamMessage(streamId: number, timestampMs: number, data: Uint8Array): number;
|
|
16
|
+
subscribeVideo(streamId: number): number;
|
|
17
|
+
unsubscribeVideo(streamId: number): number;
|
|
18
|
+
subscribeAudio(streamId: number): number;
|
|
19
|
+
unsubscribeAudio(streamId: number): number;
|
|
20
|
+
requestKeyFrame(streamId: number): number;
|
|
21
|
+
getMetricsSnapshot(): TiRtcConnMetricsResult;
|
|
22
|
+
dispose(): number;
|
|
23
|
+
private callWithStream;
|
|
24
|
+
private ensureIdentity;
|
|
25
|
+
private adoptIdentity;
|
|
26
|
+
private clearCallbacks;
|
|
27
|
+
private handleEvent;
|
|
28
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const TIRTC_ERROR_OK = 0;
|
|
2
|
+
export declare const TIRTC_ERROR_INVALID_ARGUMENT = 6000;
|
|
3
|
+
export declare const TIRTC_HOST_ERROR_OBJECT_RELEASED = 1008;
|
|
4
|
+
export type NativeCreateResultLike = Readonly<{
|
|
5
|
+
code: number;
|
|
6
|
+
objectId: number;
|
|
7
|
+
generation: number;
|
|
8
|
+
message: string | null;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function returnReleasedIfDisposed(disposed: boolean): number | null;
|
|
11
|
+
export declare function normalizeCreateResult(result: NativeCreateResultLike): NativeCreateResultLike;
|
|
12
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
13
|
+
export declare function isFiniteSafeInteger(value: unknown): value is number;
|
|
14
|
+
export declare function isUInt8(value: unknown): value is number;
|
|
15
|
+
export declare function isUInt32(value: unknown): value is number;
|
|
16
|
+
export declare function isPositiveInt32(value: unknown): value is number;
|
|
17
|
+
export declare function isPositiveInt32Size(value: unknown): value is number;
|
|
18
|
+
export declare function toNativeBytes(data: unknown): ReadonlyArray<number> | null;
|
|
19
|
+
export declare function fromNativeBytes(data: ReadonlyArray<number> | undefined): Uint8Array;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type NativeTiRtcEvent } from './native';
|
|
2
|
+
import type { NativeIdentity } from './native_object_id';
|
|
3
|
+
type NativeEventHandler = (event: NativeTiRtcEvent) => void;
|
|
4
|
+
export declare function registerNativeEventHandler(identity: NativeIdentity, handler: NativeEventHandler): void;
|
|
5
|
+
export declare function unregisterNativeEventHandler(identity: NativeIdentity): void;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { TiRtcOutputBufferStrategy, TiRtcConnState, TiRtcInputState, TiRtcAudioCodec, TiRtcAudioSampleRate, TiRtcAudioChannelCount, TiRtcAudioAecMode, TiRtcAudioAgcLevel, TiRtcAudioAnsLevel, TiRtcVideoCodec, TiRtcVideoEncoderCodec, TiRtcVideoFrameRate, TiRtcCameraFacing, TiRtcVideoDecoderPreference, TiRtcVideoDecoderBackend, TiRtcVideoBitstreamFormat, TiRtcAudioOutputState, TiRtcVideoOutputState, } from './types';
|
|
2
|
+
export type { TiRtcSize, TiRtcInitOptions, TiRtcAudioOutputOptions, TiRtcVideoOutputOptions, TiRtcVideoOutputViewProps, TiRtcAudioInputOptions, TiRtcVideoInputOptions, TiRtcVideoInputPreviewProps, TiRtcOnConnStateChanged, TiRtcOnConnCommand, TiRtcOnConnStreamMessage, TiRtcOnAudioOutputStateChanged, TiRtcOnAudioOutputError, TiRtcOnVideoOutputStateChanged, TiRtcOnVideoOutputRenderSizeChanged, TiRtcOnVideoOutputError, TiRtcOnInputStateChanged, TiRtcOnInputError, TiRtcOnVideoInputActualConfigChanged, TiRtcConnMetricsResult, TiRtcConnMetricsSnapshot, TiRtcOutputStartupMetrics, TiRtcOutputStutterMetrics, TiRtcAudioOutputMetricsResult, TiRtcAudioOutputMetricsSnapshot, TiRtcVideoOutputMetricsResult, TiRtcVideoOutputMetricsSnapshot, TiRtcAudioOutputDebugSnapshotResult, TiRtcAudioOutputDebugSnapshot, TiRtcVideoOutputDebugSnapshotResult, TiRtcVideoOutputDebugSnapshot, TiRtcLoggingUploadResult, } from './types';
|
|
3
|
+
export { TiRtc } from './runtime';
|
|
4
|
+
export { TiRtcConn } from './conn';
|
|
5
|
+
export { TiRtcAudioOutput } from './audio_output';
|
|
6
|
+
export { TiRtcVideoOutput, TiRtcVideoOutputView } from './video_output';
|
|
7
|
+
export { TiRtcAudioInput } from './audio_input';
|
|
8
|
+
export { TiRtcVideoInput, TiRtcVideoInputPreview } from './video_input';
|
|
9
|
+
export { TiRtcLogging } from './logging';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TiRtcLoggingUploadResult } from './types';
|
|
2
|
+
export declare class TiRtcLogging {
|
|
3
|
+
private constructor();
|
|
4
|
+
static d(tag: string, message: string): void;
|
|
5
|
+
static i(tag: string, message: string): void;
|
|
6
|
+
static w(tag: string, message: string): void;
|
|
7
|
+
static e(tag: string, message: string): void;
|
|
8
|
+
static upload(): Promise<TiRtcLoggingUploadResult>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import NativeTiRtc from './specs/NativeTiRtc';
|
|
2
|
+
import NativeTiRtcVideoInputPreview from './specs/TiRtcVideoInputPreviewNativeComponent';
|
|
3
|
+
import NativeTiRtcVideoOutputView from './specs/TiRtcVideoOutputViewNativeComponent';
|
|
4
|
+
export { NativeTiRtc, NativeTiRtcVideoOutputView, NativeTiRtcVideoInputPreview };
|
|
5
|
+
export type { NativeTiRtcEvent } from './specs/NativeTiRtc';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type NativeIdentity = Readonly<{
|
|
2
|
+
objectId: number;
|
|
3
|
+
generation: number;
|
|
4
|
+
}>;
|
|
5
|
+
type NativeIdentityListener = () => void;
|
|
6
|
+
export declare function isNativeIdentity(value: unknown): value is NativeIdentity;
|
|
7
|
+
export declare function setNativeIdentity(owner: object, identity: NativeIdentity): void;
|
|
8
|
+
export declare function clearNativeIdentity(owner: object): void;
|
|
9
|
+
export declare function readNativeIdentity(owner: unknown): NativeIdentity | null;
|
|
10
|
+
export declare function readNativeObjectId(owner: unknown): number | null;
|
|
11
|
+
export declare function subscribeNativeIdentity(owner: object, listener: NativeIdentityListener): () => void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TiRtcInitOptions } from './types';
|
|
2
|
+
export declare class TiRtc {
|
|
3
|
+
private constructor();
|
|
4
|
+
static initialize(config: TiRtcInitOptions): Promise<number>;
|
|
5
|
+
static shutdown(): number;
|
|
6
|
+
static errorToString(code: number): string;
|
|
7
|
+
static formatError(code: number): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import type { TurboModule, CodegenTypes } from 'react-native';
|
|
2
|
+
export type NativeObjectId = number;
|
|
3
|
+
export type NativeBytes = ReadonlyArray<number>;
|
|
4
|
+
export type NativeCreateResult = Readonly<{
|
|
5
|
+
code: number;
|
|
6
|
+
objectId: NativeObjectId;
|
|
7
|
+
generation: number;
|
|
8
|
+
message: string | null;
|
|
9
|
+
}>;
|
|
10
|
+
export type NativeInitOptions = Readonly<{
|
|
11
|
+
appId: string;
|
|
12
|
+
endpoint: string;
|
|
13
|
+
consoleLogEnabled: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export type NativeSize = Readonly<{
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}>;
|
|
19
|
+
export type NativeAudioOutputOptions = Readonly<{
|
|
20
|
+
agcLevel: 'disabled' | 'low' | 'medium' | 'high';
|
|
21
|
+
ansLevel: 'disabled' | 'low' | 'medium' | 'high';
|
|
22
|
+
bufferStrategy: 'automatic' | 'noBuffer';
|
|
23
|
+
maxBufferWatermarkMs: number | null;
|
|
24
|
+
}>;
|
|
25
|
+
export type NativeVideoOutputOptions = Readonly<{
|
|
26
|
+
decoderPreference: 'auto' | 'software' | 'hardware';
|
|
27
|
+
bufferStrategy: 'automatic' | 'noBuffer';
|
|
28
|
+
maxBufferWatermarkMs: number | null;
|
|
29
|
+
}>;
|
|
30
|
+
export type NativeAudioInputOptions = Readonly<{
|
|
31
|
+
codec: 'g711a' | 'aac' | 'pcm' | 'opus' | 'amr';
|
|
32
|
+
sampleRate: 'rate8k' | 'rate16k';
|
|
33
|
+
channels: 'mono';
|
|
34
|
+
aecMode: 'disabled' | 'enabled';
|
|
35
|
+
agcLevel: 'disabled' | 'low' | 'medium' | 'high';
|
|
36
|
+
ansLevel: 'disabled' | 'low' | 'medium' | 'high';
|
|
37
|
+
}>;
|
|
38
|
+
export type NativeVideoInputOptions = Readonly<{
|
|
39
|
+
codec: 'h264' | 'mjpeg';
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
frameRate: 'fps10' | 'fps15' | 'fps30';
|
|
43
|
+
bitrateKbps: number;
|
|
44
|
+
cameraFacing: 'front' | 'back';
|
|
45
|
+
}>;
|
|
46
|
+
export type NativeStateResult = Readonly<{
|
|
47
|
+
code: number;
|
|
48
|
+
state: string | null;
|
|
49
|
+
}>;
|
|
50
|
+
export type NativeSizeResult = Readonly<{
|
|
51
|
+
code: number;
|
|
52
|
+
size: NativeSize | null;
|
|
53
|
+
}>;
|
|
54
|
+
export type NativeVideoInputActualConfigResult = Readonly<{
|
|
55
|
+
code: number;
|
|
56
|
+
size: NativeSize | null;
|
|
57
|
+
fps: number | null;
|
|
58
|
+
}>;
|
|
59
|
+
export type NativeLoggingUploadResult = Readonly<{
|
|
60
|
+
code: number;
|
|
61
|
+
logId: string | null;
|
|
62
|
+
}>;
|
|
63
|
+
export type NativeTiRtcEvent = Readonly<{
|
|
64
|
+
type: string;
|
|
65
|
+
objectId: NativeObjectId;
|
|
66
|
+
generation: number;
|
|
67
|
+
state?: string;
|
|
68
|
+
errorCode?: number;
|
|
69
|
+
code?: number;
|
|
70
|
+
message?: string | null;
|
|
71
|
+
commandId?: number;
|
|
72
|
+
streamId?: number;
|
|
73
|
+
timestampMs?: number;
|
|
74
|
+
data?: NativeBytes;
|
|
75
|
+
size?: NativeSize;
|
|
76
|
+
fps?: number;
|
|
77
|
+
}>;
|
|
78
|
+
type NativeConnMetricsResult = Readonly<{
|
|
79
|
+
code: number;
|
|
80
|
+
snapshot: Readonly<{
|
|
81
|
+
hasConnectStart: boolean;
|
|
82
|
+
hasConnected: boolean;
|
|
83
|
+
connectStartMonotonicMs: number;
|
|
84
|
+
connectedMonotonicMs: number;
|
|
85
|
+
isReady: boolean;
|
|
86
|
+
connectDurationMs: number | null;
|
|
87
|
+
}> | null;
|
|
88
|
+
}>;
|
|
89
|
+
type NativeOutputStartupMetrics = Readonly<{
|
|
90
|
+
hasConnectStart: boolean;
|
|
91
|
+
hasConnected: boolean;
|
|
92
|
+
hasFirstPacket: boolean;
|
|
93
|
+
hasFirstOutput: boolean;
|
|
94
|
+
connectStartMonotonicMs: number;
|
|
95
|
+
connectedMonotonicMs: number;
|
|
96
|
+
firstPacketMonotonicMs: number;
|
|
97
|
+
firstOutputMonotonicMs: number;
|
|
98
|
+
firstPacketAfterConnectedMs: number;
|
|
99
|
+
firstOutputAfterConnectedMs: number;
|
|
100
|
+
timeToFirstOutputMs: number;
|
|
101
|
+
}>;
|
|
102
|
+
type NativeOutputStutterMetrics = Readonly<{
|
|
103
|
+
stutterThresholdMs: number;
|
|
104
|
+
outputDurationMs: number;
|
|
105
|
+
stutterTotalMs: number;
|
|
106
|
+
stutterCount: number;
|
|
107
|
+
stutterPeakMs: number;
|
|
108
|
+
stutterAverageMs: number;
|
|
109
|
+
stutterRatePercent: number;
|
|
110
|
+
}>;
|
|
111
|
+
type NativeAudioOutputMetricsResult = Readonly<{
|
|
112
|
+
code: number;
|
|
113
|
+
snapshot: Readonly<{
|
|
114
|
+
startup: NativeOutputStartupMetrics;
|
|
115
|
+
stutter: NativeOutputStutterMetrics;
|
|
116
|
+
estimatedOutputLatencyMs: number;
|
|
117
|
+
audioCodec: 'g711a' | 'aac' | 'pcm' | 'opus' | 'amr' | null;
|
|
118
|
+
audioSampleRateHz: number;
|
|
119
|
+
audioChannels: number;
|
|
120
|
+
audioInputBitrateKbps: number;
|
|
121
|
+
audioInputPacketRate: number;
|
|
122
|
+
audioRenderCallbackRate: number;
|
|
123
|
+
statsRefreshIntervalMs: number;
|
|
124
|
+
statsUpdatedAtMonotonicMs: number;
|
|
125
|
+
}> | null;
|
|
126
|
+
}>;
|
|
127
|
+
type NativeVideoOutputMetricsResult = Readonly<{
|
|
128
|
+
code: number;
|
|
129
|
+
snapshot: Readonly<{
|
|
130
|
+
startup: NativeOutputStartupMetrics;
|
|
131
|
+
stutter: NativeOutputStutterMetrics;
|
|
132
|
+
estimatedOutputLatencyMs: number;
|
|
133
|
+
videoCodec: 'h264' | 'h265' | 'mjpeg' | null;
|
|
134
|
+
videoWidth: number;
|
|
135
|
+
videoHeight: number;
|
|
136
|
+
decoderBackend: 'unknown' | 'software' | 'hardware';
|
|
137
|
+
videoInputBitrateKbps: number;
|
|
138
|
+
videoInputFps: number;
|
|
139
|
+
videoDecodedFps: number;
|
|
140
|
+
videoRenderFps: number;
|
|
141
|
+
statsRefreshIntervalMs: number;
|
|
142
|
+
statsUpdatedAtMonotonicMs: number;
|
|
143
|
+
}> | null;
|
|
144
|
+
}>;
|
|
145
|
+
type NativeAudioOutputDebugSnapshotResult = Readonly<{
|
|
146
|
+
code: number;
|
|
147
|
+
snapshot: Readonly<{
|
|
148
|
+
codec: 'g711a' | 'aac' | 'pcm' | 'opus' | 'amr' | null;
|
|
149
|
+
sampleRateHz: number;
|
|
150
|
+
channels: number;
|
|
151
|
+
}> | null;
|
|
152
|
+
}>;
|
|
153
|
+
type NativeVideoOutputDebugSnapshotResult = Readonly<{
|
|
154
|
+
code: number;
|
|
155
|
+
snapshot: Readonly<{
|
|
156
|
+
codec: 'h264' | 'h265' | 'mjpeg' | null;
|
|
157
|
+
bitstreamFormat: 'unknown' | 'h264AnnexB' | 'h265AnnexB' | 'mjpegJfif';
|
|
158
|
+
width: number;
|
|
159
|
+
height: number;
|
|
160
|
+
decoderPreference: 'auto' | 'software' | 'hardware';
|
|
161
|
+
resolvedDecoderBackend: 'unknown' | 'software' | 'hardware';
|
|
162
|
+
}> | null;
|
|
163
|
+
}>;
|
|
164
|
+
interface Spec extends TurboModule {
|
|
165
|
+
readonly onTiRtcEvent: CodegenTypes.EventEmitter<NativeTiRtcEvent>;
|
|
166
|
+
initialize(options: NativeInitOptions): Promise<number>;
|
|
167
|
+
shutdown(): number;
|
|
168
|
+
errorToString(code: number): string;
|
|
169
|
+
writeLog(level: number, tag: string, message: string): void;
|
|
170
|
+
uploadLogs(): Promise<NativeLoggingUploadResult>;
|
|
171
|
+
createConn(): NativeCreateResult;
|
|
172
|
+
connGetState(id: NativeObjectId): NativeStateResult;
|
|
173
|
+
connConnect(id: NativeObjectId, remoteId: string, token: string): number;
|
|
174
|
+
connDisconnect(id: NativeObjectId): number;
|
|
175
|
+
connSendCommand(id: NativeObjectId, commandId: number, data: NativeBytes): number;
|
|
176
|
+
connSendStreamMessage(id: NativeObjectId, streamId: number, timestampMs: number, data: NativeBytes): number;
|
|
177
|
+
connSubscribeVideo(id: NativeObjectId, streamId: number): number;
|
|
178
|
+
connUnsubscribeVideo(id: NativeObjectId, streamId: number): number;
|
|
179
|
+
connSubscribeAudio(id: NativeObjectId, streamId: number): number;
|
|
180
|
+
connUnsubscribeAudio(id: NativeObjectId, streamId: number): number;
|
|
181
|
+
connRequestKeyFrame(id: NativeObjectId, streamId: number): number;
|
|
182
|
+
connGetMetricsSnapshot(id: NativeObjectId): NativeConnMetricsResult;
|
|
183
|
+
connDispose(id: NativeObjectId): number;
|
|
184
|
+
createAudioOutput(): NativeCreateResult;
|
|
185
|
+
audioOutputGetState(id: NativeObjectId): NativeStateResult;
|
|
186
|
+
audioOutputConfigure(id: NativeObjectId, options: NativeAudioOutputOptions): number;
|
|
187
|
+
audioOutputSetVolume(id: NativeObjectId, volumePercent: number): number;
|
|
188
|
+
audioOutputAttach(id: NativeObjectId, connId: NativeObjectId, streamId: number): number;
|
|
189
|
+
audioOutputDetach(id: NativeObjectId): number;
|
|
190
|
+
audioOutputGetMetricsSnapshot(id: NativeObjectId): NativeAudioOutputMetricsResult;
|
|
191
|
+
audioOutputResetMetricsSession(id: NativeObjectId): number;
|
|
192
|
+
audioOutputGetDebugSnapshot(id: NativeObjectId): NativeAudioOutputDebugSnapshotResult;
|
|
193
|
+
audioOutputDispose(id: NativeObjectId): number;
|
|
194
|
+
createVideoOutput(): NativeCreateResult;
|
|
195
|
+
videoOutputGetState(id: NativeObjectId): NativeStateResult;
|
|
196
|
+
videoOutputGetRenderSize(id: NativeObjectId): NativeSizeResult;
|
|
197
|
+
videoOutputSetOptions(id: NativeObjectId, options: NativeVideoOutputOptions): number;
|
|
198
|
+
videoOutputAttach(id: NativeObjectId, connId: NativeObjectId, streamId: number): number;
|
|
199
|
+
videoOutputDetach(id: NativeObjectId): number;
|
|
200
|
+
videoOutputGetMetricsSnapshot(id: NativeObjectId): NativeVideoOutputMetricsResult;
|
|
201
|
+
videoOutputResetMetricsSession(id: NativeObjectId): number;
|
|
202
|
+
videoOutputGetDebugSnapshot(id: NativeObjectId): NativeVideoOutputDebugSnapshotResult;
|
|
203
|
+
videoOutputDispose(id: NativeObjectId): number;
|
|
204
|
+
createAudioInput(): NativeCreateResult;
|
|
205
|
+
audioInputGetState(id: NativeObjectId): NativeStateResult;
|
|
206
|
+
audioInputSetOptions(id: NativeObjectId, options: NativeAudioInputOptions): Promise<number>;
|
|
207
|
+
audioInputAttach(id: NativeObjectId, connId: NativeObjectId, streamId: number): Promise<number>;
|
|
208
|
+
audioInputStart(id: NativeObjectId): Promise<number>;
|
|
209
|
+
audioInputStop(id: NativeObjectId): Promise<number>;
|
|
210
|
+
audioInputDetach(id: NativeObjectId, connId: NativeObjectId): Promise<number>;
|
|
211
|
+
audioInputDispose(id: NativeObjectId): Promise<number>;
|
|
212
|
+
createVideoInput(): NativeCreateResult;
|
|
213
|
+
videoInputGetState(id: NativeObjectId): NativeStateResult;
|
|
214
|
+
videoInputGetActualConfig(id: NativeObjectId): NativeVideoInputActualConfigResult;
|
|
215
|
+
videoInputSetOptions(id: NativeObjectId, options: NativeVideoInputOptions): Promise<number>;
|
|
216
|
+
videoInputAttach(id: NativeObjectId, connId: NativeObjectId, streamId: number): Promise<number>;
|
|
217
|
+
videoInputStart(id: NativeObjectId): Promise<number>;
|
|
218
|
+
videoInputStop(id: NativeObjectId): Promise<number>;
|
|
219
|
+
videoInputDetach(id: NativeObjectId, connId: NativeObjectId): Promise<number>;
|
|
220
|
+
videoInputDispose(id: NativeObjectId): Promise<number>;
|
|
221
|
+
}
|
|
222
|
+
declare const _default: Spec;
|
|
223
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CodegenTypes, type ViewProps } from 'react-native';
|
|
2
|
+
export interface NativeTiRtcVideoInputPreviewProps extends ViewProps {
|
|
3
|
+
readonly nativeObjectId: CodegenTypes.Int32;
|
|
4
|
+
readonly generation: CodegenTypes.Int32;
|
|
5
|
+
readonly resizeMode?: CodegenTypes.WithDefault<'contain' | 'cover' | 'stretch', 'contain'>;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: unknown;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CodegenTypes, type ViewProps } from 'react-native';
|
|
2
|
+
export interface NativeTiRtcVideoOutputViewProps extends ViewProps {
|
|
3
|
+
readonly nativeObjectId: CodegenTypes.Int32;
|
|
4
|
+
readonly generation: CodegenTypes.Int32;
|
|
5
|
+
readonly resizeMode?: CodegenTypes.WithDefault<'contain' | 'cover' | 'stretch', 'contain'>;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: unknown;
|
|
8
|
+
export default _default;
|