tirtc-react-native 2.4.0-alpha.3 → 2.4.0-alpha.4
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 +6 -6
- package/TiRtcReactNative.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcModule.kt +146 -109
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeCleanup.kt +23 -23
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeEventBinder.kt +21 -24
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeEventSink.kt +6 -10
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeMaps.kt +5 -5
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcReactNativeRegistry.kt +11 -11
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/{TiRtcReactNativeStoreSupport.kt → TiRtcReactNativeStorageSupport.kt} +9 -9
- package/android/src/main/java/com/tange/ai/tirtc/reactnative/TiRtcVideoOutputViewManager.kt +2 -2
- package/ios/TiRtcReactNative+Conn.mm +5 -5
- package/ios/TiRtcReactNative+Storage.mm +513 -0
- package/ios/TiRtcReactNative.mm +19 -19
- package/ios/TiRtcReactNativeEventBinder.h +8 -8
- package/ios/TiRtcReactNativeEventBinder.mm +31 -33
- package/ios/TiRtcReactNativeEventSink.h +3 -4
- package/ios/TiRtcReactNativeEventSink.mm +6 -10
- package/ios/TiRtcVideoOutputView.mm +4 -4
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/{store.js → storage.js} +184 -176
- package/lib/module/storage.js.map +1 -0
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/specs/NativeTiRtc.d.ts +42 -42
- package/lib/typescript/storage.d.ts +204 -0
- package/package.json +1 -1
- package/src/index.ts +44 -44
- package/src/specs/NativeTiRtc.ts +47 -47
- package/src/storage.ts +769 -0
- package/ios/TiRtcReactNative+Store.mm +0 -496
- package/lib/module/store.js.map +0 -1
- package/lib/typescript/store.d.ts +0 -202
- package/src/store.ts +0 -760
|
@@ -16,43 +16,40 @@ import com.tange.ai.tirtc.TiRtcVideoOutput
|
|
|
16
16
|
import com.tange.ai.tirtc.TiRtcVideoOutputErrorListener
|
|
17
17
|
import com.tange.ai.tirtc.TiRtcVideoOutputRenderSizeListener
|
|
18
18
|
import com.tange.ai.tirtc.TiRtcVideoOutputStateListener
|
|
19
|
-
import com.tange.ai.tirtc.
|
|
20
|
-
import com.tange.ai.tirtc.
|
|
21
|
-
import com.tange.ai.tirtc.
|
|
22
|
-
import com.tange.ai.tirtc.
|
|
23
|
-
import com.tange.ai.tirtc.
|
|
24
|
-
import com.tange.ai.tirtc.
|
|
25
|
-
import com.tange.ai.tirtc.
|
|
26
|
-
import com.tange.ai.tirtc.
|
|
27
|
-
import com.tange.ai.tirtc.
|
|
28
|
-
import com.tange.ai.tirtc.
|
|
29
|
-
import com.tange.ai.tirtc.TiStoreVideoOutputStateListener
|
|
19
|
+
import com.tange.ai.tirtc.TiCloudStorage
|
|
20
|
+
import com.tange.ai.tirtc.TiCloudStorageAudioOutput
|
|
21
|
+
import com.tange.ai.tirtc.TiCloudStorageAudioOutputStateListener
|
|
22
|
+
import com.tange.ai.tirtc.TiCloudStorageOutputErrorListener
|
|
23
|
+
import com.tange.ai.tirtc.TiCloudStorageReplay
|
|
24
|
+
import com.tange.ai.tirtc.TiCloudStorageReplayCompletedListener
|
|
25
|
+
import com.tange.ai.tirtc.TiCloudStorageReplayErrorListener
|
|
26
|
+
import com.tange.ai.tirtc.TiCloudStorageTimeChangedListener
|
|
27
|
+
import com.tange.ai.tirtc.TiCloudStorageVideoOutput
|
|
28
|
+
import com.tange.ai.tirtc.TiCloudStorageVideoOutputStateListener
|
|
30
29
|
|
|
31
30
|
internal class TiRtcReactNativeEventBinder(
|
|
32
31
|
private val events: TiRtcReactNativeEventSink,
|
|
33
32
|
) {
|
|
34
|
-
fun
|
|
35
|
-
store.onTokenExpired = TiStoreTokenExpiredListener { events.storeTokenExpired(id) }
|
|
36
|
-
}
|
|
33
|
+
fun wireCloudStorage(id: Int, cloudStorage: TiCloudStorage) = Unit
|
|
37
34
|
|
|
38
|
-
fun
|
|
39
|
-
replay.onTimeChanged =
|
|
40
|
-
replay.onCompleted =
|
|
41
|
-
replay.onError =
|
|
35
|
+
fun wireCloudStorageReplay(id: Int, replay: TiCloudStorageReplay) {
|
|
36
|
+
replay.onTimeChanged = TiCloudStorageTimeChangedListener { events.tiCloudStorageReplayTimeChanged(id, it) }
|
|
37
|
+
replay.onCompleted = TiCloudStorageReplayCompletedListener { events.tiCloudStorageReplayCompleted(id) }
|
|
38
|
+
replay.onError = TiCloudStorageReplayErrorListener { events.tiCloudStorageReplayError(id, it) }
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
fun
|
|
45
|
-
output.onStateChanged =
|
|
41
|
+
fun wireCloudStorageAudioOutput(id: Int, output: TiCloudStorageAudioOutput) {
|
|
42
|
+
output.onStateChanged = TiCloudStorageAudioOutputStateListener {
|
|
46
43
|
events.audioOutputStateChanged(id, it.name.lowercase())
|
|
47
44
|
}
|
|
48
|
-
output.onError =
|
|
45
|
+
output.onError = TiCloudStorageOutputErrorListener { events.audioOutputError(id, it) }
|
|
49
46
|
}
|
|
50
47
|
|
|
51
|
-
fun
|
|
52
|
-
output.onStateChanged =
|
|
48
|
+
fun wireCloudStorageVideoOutput(id: Int, output: TiCloudStorageVideoOutput) {
|
|
49
|
+
output.onStateChanged = TiCloudStorageVideoOutputStateListener {
|
|
53
50
|
events.videoOutputStateChanged(id, it.name.lowercase())
|
|
54
51
|
}
|
|
55
|
-
output.onError =
|
|
52
|
+
output.onError = TiCloudStorageOutputErrorListener { events.videoOutputError(id, it) }
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
fun wireConn(
|
|
@@ -44,22 +44,18 @@ internal class TiRtcReactNativeEventSink(
|
|
|
44
44
|
})
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
fun
|
|
48
|
-
emit(base("
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
fun storeReplayTimeChanged(objectId: Int, timestampMs: Long) {
|
|
52
|
-
emit(base("storeReplayTimeChanged", objectId).apply {
|
|
47
|
+
fun tiCloudStorageReplayTimeChanged(objectId: Int, timestampMs: Long) {
|
|
48
|
+
emit(base("tiCloudStorageReplayTimeChanged", objectId).apply {
|
|
53
49
|
putDouble("timestampMs", timestampMs.toDouble())
|
|
54
50
|
})
|
|
55
51
|
}
|
|
56
52
|
|
|
57
|
-
fun
|
|
58
|
-
emit(base("
|
|
53
|
+
fun tiCloudStorageReplayCompleted(objectId: Int) {
|
|
54
|
+
emit(base("tiCloudStorageReplayCompleted", objectId))
|
|
59
55
|
}
|
|
60
56
|
|
|
61
|
-
fun
|
|
62
|
-
emit(base("
|
|
57
|
+
fun tiCloudStorageReplayError(objectId: Int, code: Int) {
|
|
58
|
+
emit(base("tiCloudStorageReplayError", objectId).apply {
|
|
63
59
|
putInt("code", TiRtcReactNativeErrors.normalizeAndroid(code))
|
|
64
60
|
})
|
|
65
61
|
}
|
|
@@ -2,8 +2,8 @@ package com.tange.ai.tirtc.reactnative
|
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.Arguments
|
|
4
4
|
import com.facebook.react.bridge.WritableMap
|
|
5
|
-
import com.tange.ai.tirtc.
|
|
6
|
-
import com.tange.ai.tirtc.
|
|
5
|
+
import com.tange.ai.tirtc.TiCloudStorageRecordingRange
|
|
6
|
+
import com.tange.ai.tirtc.TiCloudStorageRecordingDay
|
|
7
7
|
|
|
8
8
|
internal fun recordingStartResult(code: Int, taskId: Int?): WritableMap =
|
|
9
9
|
Arguments.createMap().apply {
|
|
@@ -11,7 +11,7 @@ internal fun recordingStartResult(code: Int, taskId: Int?): WritableMap =
|
|
|
11
11
|
if (taskId == null) putNull("taskId") else putInt("taskId", taskId)
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
internal fun
|
|
14
|
+
internal fun tiCloudStorageRecordingsResult(code: Int, ranges: List<TiCloudStorageRecordingRange>): WritableMap =
|
|
15
15
|
Arguments.createMap().apply {
|
|
16
16
|
putInt("code", code)
|
|
17
17
|
putArray("recordings", Arguments.createArray().apply {
|
|
@@ -24,7 +24,7 @@ internal fun storeRecordingsResult(code: Int, ranges: List<TiStoreRecordingRange
|
|
|
24
24
|
})
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
internal fun
|
|
27
|
+
internal fun tiCloudStorageRecordingDaysResult(code: Int, days: List<TiCloudStorageRecordingDay>): WritableMap =
|
|
28
28
|
Arguments.createMap().apply {
|
|
29
29
|
putInt("code", code)
|
|
30
30
|
putArray("days", Arguments.createArray().apply {
|
|
@@ -37,7 +37,7 @@ internal fun storeRecordingDaysResult(code: Int, days: List<TiStoreRecordingDay>
|
|
|
37
37
|
})
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
internal fun
|
|
40
|
+
internal fun tiCloudStorageReplayInfoResult(code: Int, speed: Int, currentTimeMs: Long?): WritableMap =
|
|
41
41
|
Arguments.createMap().apply {
|
|
42
42
|
putInt("code", code)
|
|
43
43
|
putInt("speed", speed)
|
|
@@ -6,11 +6,11 @@ import com.tange.ai.tirtc.TiRtcConn
|
|
|
6
6
|
import com.tange.ai.tirtc.TiRtcVideoInput
|
|
7
7
|
import com.tange.ai.tirtc.TiRtcVideoOutput
|
|
8
8
|
import com.tange.ai.tirtc.TiRtcRecordingTask
|
|
9
|
-
import com.tange.ai.tirtc.
|
|
10
|
-
import com.tange.ai.tirtc.
|
|
11
|
-
import com.tange.ai.tirtc.
|
|
12
|
-
import com.tange.ai.tirtc.
|
|
13
|
-
import com.tange.ai.tirtc.
|
|
9
|
+
import com.tange.ai.tirtc.TiCloudStorage
|
|
10
|
+
import com.tange.ai.tirtc.TiCloudStorageAudioOutput
|
|
11
|
+
import com.tange.ai.tirtc.TiCloudStorageRecordingTask
|
|
12
|
+
import com.tange.ai.tirtc.TiCloudStorageReplay
|
|
13
|
+
import com.tange.ai.tirtc.TiCloudStorageVideoOutput
|
|
14
14
|
import java.util.concurrent.ConcurrentHashMap
|
|
15
15
|
import java.util.concurrent.atomic.AtomicInteger
|
|
16
16
|
|
|
@@ -63,17 +63,17 @@ internal object TiRtcReactNativeRegistry {
|
|
|
63
63
|
|
|
64
64
|
fun recordingTask(id: Int): TiRtcRecordingTask? = entries[id]?.value as? TiRtcRecordingTask
|
|
65
65
|
|
|
66
|
-
fun
|
|
66
|
+
fun cloudStorage(id: Int): TiCloudStorage? = entries[id]?.value as? TiCloudStorage
|
|
67
67
|
|
|
68
|
-
fun
|
|
68
|
+
fun tiCloudStorageReplay(id: Int): TiCloudStorageReplay? = entries[id]?.value as? TiCloudStorageReplay
|
|
69
69
|
|
|
70
|
-
fun
|
|
70
|
+
fun tiCloudStorageRecordingTask(id: Int): TiCloudStorageRecordingTask? = entries[id]?.value as? TiCloudStorageRecordingTask
|
|
71
71
|
|
|
72
|
-
fun
|
|
72
|
+
fun tiCloudStorageExportTask(id: Int): CloudStorageExportBridge? = entries[id]?.value as? CloudStorageExportBridge
|
|
73
73
|
|
|
74
|
-
fun
|
|
74
|
+
fun tiCloudStorageAudioOutput(id: Int): TiCloudStorageAudioOutput? = entries[id]?.value as? TiCloudStorageAudioOutput
|
|
75
75
|
|
|
76
|
-
fun
|
|
76
|
+
fun tiCloudStorageVideoOutput(id: Int): TiCloudStorageVideoOutput? = entries[id]?.value as? TiCloudStorageVideoOutput
|
|
77
77
|
|
|
78
78
|
fun reportVideoOutputError(
|
|
79
79
|
id: Int,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
package com.tange.ai.tirtc.reactnative
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.Promise
|
|
4
|
-
import com.tange.ai.tirtc.
|
|
5
|
-
import com.tange.ai.tirtc.
|
|
4
|
+
import com.tange.ai.tirtc.TiCloudStorageExportTask
|
|
5
|
+
import com.tange.ai.tirtc.TiCloudStorageRecordingResult
|
|
6
6
|
|
|
7
|
-
internal class
|
|
8
|
-
private val resolve: (Promise,
|
|
7
|
+
internal class CloudStorageExportBridge(
|
|
8
|
+
private val resolve: (Promise, TiCloudStorageRecordingResult) -> Unit,
|
|
9
9
|
) {
|
|
10
|
-
@Volatile var task:
|
|
10
|
+
@Volatile var task: TiCloudStorageExportTask? = null
|
|
11
11
|
@Volatile var onDrained: (() -> Unit)? = null
|
|
12
|
-
private var result:
|
|
12
|
+
private var result: TiCloudStorageRecordingResult? = null
|
|
13
13
|
private val waiters = mutableListOf<Promise>()
|
|
14
14
|
private var invalidated = false
|
|
15
|
-
private var invalidationCompletion: ((
|
|
15
|
+
private var invalidationCompletion: ((TiCloudStorageRecordingResult?) -> Unit)? = null
|
|
16
16
|
|
|
17
|
-
fun complete(value:
|
|
17
|
+
fun complete(value: TiCloudStorageRecordingResult) {
|
|
18
18
|
val completed = synchronized(this) {
|
|
19
19
|
if (result != null) return
|
|
20
20
|
result = value
|
|
@@ -40,7 +40,7 @@ internal class StoreExportBridge(
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
fun invalidate(onTerminal: (
|
|
43
|
+
fun invalidate(onTerminal: (TiCloudStorageRecordingResult?) -> Unit) {
|
|
44
44
|
val completed = synchronized(this) {
|
|
45
45
|
invalidated = true
|
|
46
46
|
waiters.clear()
|
|
@@ -88,7 +88,7 @@ class TiRtcVideoOutputViewManager :
|
|
|
88
88
|
view.setTag(ATTACHED_GENERATION_TAG, generation)
|
|
89
89
|
return
|
|
90
90
|
}
|
|
91
|
-
TiRtcReactNativeRegistry.
|
|
91
|
+
TiRtcReactNativeRegistry.tiCloudStorageVideoOutput(nativeObjectId)?.let { output ->
|
|
92
92
|
val code = output.attachView(view)
|
|
93
93
|
if (TiRtcReactNativeErrors.normalizeAndroid(code) != TiRtcReactNativeErrors.OK) {
|
|
94
94
|
TiRtcReactNativeRegistry.reportVideoOutputError(nativeObjectId, code)
|
|
@@ -101,7 +101,7 @@ class TiRtcVideoOutputViewManager :
|
|
|
101
101
|
|
|
102
102
|
private fun detachView(id: Int) {
|
|
103
103
|
TiRtcReactNativeRegistry.videoOutput(id)?.detachView()
|
|
104
|
-
?: TiRtcReactNativeRegistry.
|
|
104
|
+
?: TiRtcReactNativeRegistry.tiCloudStorageVideoOutput(id)?.detachView()
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
private fun resizeModeForView(view: FrameLayout): TiRtcVideoViewResizeMode =
|
|
@@ -179,14 +179,14 @@ static NSString* TiRtcReactNativeGalleryFileName(NSString* fileName, BOOL video)
|
|
|
179
179
|
id file = [[self registry] transientObjectForId:(NSInteger)objectId];
|
|
180
180
|
if (![file isKindOfClass:[TiRtcRecordingFile class]] &&
|
|
181
181
|
![file isKindOfClass:[TiRtcSnapshotFile class]] &&
|
|
182
|
-
![file isKindOfClass:[
|
|
183
|
-
![file isKindOfClass:[
|
|
182
|
+
![file isKindOfClass:[TiCloudStorageRecordingFile class]] &&
|
|
183
|
+
![file isKindOfClass:[TiCloudStorageSnapshotFile class]]) {
|
|
184
184
|
resolve(@{@"code" : @(TiRtcReactNativeErrorObjectReleased), @"uri" : (id)kCFNull});
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
187
|
NSString* path = [file path];
|
|
188
188
|
BOOL video = [file isKindOfClass:[TiRtcRecordingFile class]] ||
|
|
189
|
-
[file isKindOfClass:[
|
|
189
|
+
[file isKindOfClass:[TiCloudStorageRecordingFile class]];
|
|
190
190
|
NSString* normalizedName = TiRtcReactNativeGalleryFileName(fileName, video);
|
|
191
191
|
if (normalizedName == nil) {
|
|
192
192
|
resolve(@{@"code" : @6000, @"uri" : (id)kCFNull});
|
|
@@ -244,8 +244,8 @@ static NSString* TiRtcReactNativeGalleryFileName(NSString* fileName, BOOL video)
|
|
|
244
244
|
id file = [[self registry] transientObjectForId:(NSInteger)objectId];
|
|
245
245
|
if (![file isKindOfClass:[TiRtcRecordingFile class]] &&
|
|
246
246
|
![file isKindOfClass:[TiRtcSnapshotFile class]] &&
|
|
247
|
-
![file isKindOfClass:[
|
|
248
|
-
![file isKindOfClass:[
|
|
247
|
+
![file isKindOfClass:[TiCloudStorageRecordingFile class]] &&
|
|
248
|
+
![file isKindOfClass:[TiCloudStorageSnapshotFile class]]) {
|
|
249
249
|
resolve(@(TiRtcReactNativeErrorObjectReleased));
|
|
250
250
|
return;
|
|
251
251
|
}
|