react-native-tpstreams 1.0.3-debug.9 → 1.0.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 +552 -76
- package/TPStreamsRNPlayerView.podspec +1 -1
- package/android/src/main/java/com/tpstreams/JsonUtils.kt +46 -0
- package/android/src/main/java/com/tpstreams/TPStreamsDownloadModule.kt +2 -7
- package/android/src/main/java/com/tpstreams/TPStreamsRNPlayerView.kt +3 -3
- package/ios/TPStreamsDownloadModule.swift +0 -13
- package/ios/TPStreamsRNPlayerView.swift +2 -2
- package/lib/typescript/src/TPStreamsDownload.d.ts +1 -1
- package/lib/typescript/src/TPStreamsDownload.d.ts.map +1 -1
- package/lib/typescript/src/TPStreamsPlayer.d.ts +1 -1
- package/lib/typescript/src/TPStreamsPlayer.d.ts.map +1 -1
- package/package.json +1 -4
- package/src/TPStreamsDownload.tsx +1 -1
- package/src/TPStreamsPlayer.tsx +1 -1
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerDelegate.java +0 -87
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerInterface.java +0 -34
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -36
- package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec-generated.cpp +0 -22
- package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec.h +0 -24
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.cpp +0 -22
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h +0 -24
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.cpp +0 -107
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h +0 -81
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.cpp +0 -32
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.h +0 -34
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.cpp +0 -17
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h +0 -32
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.cpp +0 -16
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.h +0 -29
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI-generated.cpp +0 -17
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI.h +0 -19
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
package com.tpstreams
|
|
2
|
+
|
|
3
|
+
import org.json.JSONObject
|
|
4
|
+
|
|
5
|
+
object JsonUtils {
|
|
6
|
+
|
|
7
|
+
fun parseJsonString(map: Map<String, Any>?): Map<String, Any> {
|
|
8
|
+
val result = mutableMapOf<String, Any>()
|
|
9
|
+
map?.forEach { (key, value) ->
|
|
10
|
+
when (value) {
|
|
11
|
+
is String -> {
|
|
12
|
+
if (value.startsWith("{") && value.endsWith("}")) {
|
|
13
|
+
try {
|
|
14
|
+
val json = JSONObject(value)
|
|
15
|
+
result[key] = jsonToMap(json)
|
|
16
|
+
} catch (e: Exception) {
|
|
17
|
+
result[key] = value
|
|
18
|
+
}
|
|
19
|
+
} else {
|
|
20
|
+
result[key] = value
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else -> result[key] = value
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return result
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private fun jsonToMap(json: JSONObject): Map<String, Any> {
|
|
30
|
+
val map = mutableMapOf<String, Any>()
|
|
31
|
+
val keys = json.keys()
|
|
32
|
+
while (keys.hasNext()) {
|
|
33
|
+
val key = keys.next()
|
|
34
|
+
val value = json.get(key)
|
|
35
|
+
when (value) {
|
|
36
|
+
is String -> map[key] = value
|
|
37
|
+
is Int -> map[key] = value
|
|
38
|
+
is Double -> map[key] = value
|
|
39
|
+
is Boolean -> map[key] = value
|
|
40
|
+
is JSONObject -> map[key] = jsonToMap(value)
|
|
41
|
+
else -> map[key] = value.toString()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return map
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -109,13 +109,8 @@ class TPStreamsDownloadModule(private val reactContext: ReactApplicationContext)
|
|
|
109
109
|
map.putDouble("downloadedBytes", item.downloadedBytes.toDouble())
|
|
110
110
|
map.putDouble("progressPercentage", item.progressPercentage.toDouble())
|
|
111
111
|
map.putString("state", downloadClient.getDownloadStatus(item.assetId))
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
item.metadata.forEach { (key, value) ->
|
|
115
|
-
metadataJson.put(key, value)
|
|
116
|
-
}
|
|
117
|
-
map.putString("metadata", metadataJson.toString())
|
|
118
|
-
|
|
112
|
+
val parsedMetadata = JsonUtils.parseJsonString(item.metadata)
|
|
113
|
+
map.putMap("metadata", Arguments.makeNativeMap(parsedMetadata))
|
|
119
114
|
return map
|
|
120
115
|
}
|
|
121
116
|
|
|
@@ -30,7 +30,7 @@ class TPStreamsRNPlayerView(context: ThemedReactContext) : FrameLayout(context)
|
|
|
30
30
|
private var startAt: Long = 0
|
|
31
31
|
private var showDefaultCaptions: Boolean = false
|
|
32
32
|
private var enableDownload: Boolean = false
|
|
33
|
-
private var downloadMetadata: Map<String,
|
|
33
|
+
private var downloadMetadata: Map<String, Any>? = null
|
|
34
34
|
private var offlineLicenseExpireTime: Long = DEFAULT_OFFLINE_LICENSE_EXPIRE_TIME
|
|
35
35
|
private var accessTokenCallback: ((String) -> Unit)? = null
|
|
36
36
|
|
|
@@ -87,7 +87,7 @@ class TPStreamsRNPlayerView(context: ThemedReactContext) : FrameLayout(context)
|
|
|
87
87
|
this.enableDownload = enableDownload
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
fun setDownloadMetadata(metadata: Map<String,
|
|
90
|
+
fun setDownloadMetadata(metadata: Map<String, Any>?) {
|
|
91
91
|
this.downloadMetadata = metadata
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -116,7 +116,7 @@ class TPStreamsRNPlayerView(context: ThemedReactContext) : FrameLayout(context)
|
|
|
116
116
|
startAt,
|
|
117
117
|
enableDownload,
|
|
118
118
|
showDefaultCaptions,
|
|
119
|
-
downloadMetadata,
|
|
119
|
+
downloadMetadata?.mapValues { it.value.toString() },
|
|
120
120
|
offlineLicenseExpireTime
|
|
121
121
|
)
|
|
122
122
|
|
|
@@ -33,7 +33,6 @@ class TPStreamsDownloadModule: RCTEventEmitter, TPStreamsDownloadDelegate {
|
|
|
33
33
|
super.init()
|
|
34
34
|
TPStreamsDownloadModule._shared = self
|
|
35
35
|
downloadManager.setTPStreamsDownloadDelegate(tpStreamsDownloadDelegate: self)
|
|
36
|
-
print("TPStreamsDownloadModule init")
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
func setAccessTokenDelegate(_ delegate: TokenRequestDelegate) {
|
|
@@ -49,37 +48,29 @@ class TPStreamsDownloadModule: RCTEventEmitter, TPStreamsDownloadDelegate {
|
|
|
49
48
|
func addDownloadProgressListener(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
50
49
|
isListening = true
|
|
51
50
|
notifyDownloadsChange()
|
|
52
|
-
print("TPStreamsDownloadModule addDownloadProgressListener")
|
|
53
51
|
resolve(nil)
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
@objc
|
|
57
55
|
func removeDownloadProgressListener(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
58
56
|
isListening = false
|
|
59
|
-
print("TPStreamsDownloadModule removeDownloadProgressListener")
|
|
60
57
|
resolve(nil)
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
func onProgressChange(assetId: String, percentage: Double) {
|
|
64
|
-
print("TPStreamsDownloadModule onProgressChange isListening: \(isListening)")
|
|
65
61
|
if isListening {
|
|
66
|
-
print("TPStreamsDownloadModule onProgressChange notifyDownloadsChange")
|
|
67
62
|
notifyDownloadsChange()
|
|
68
63
|
}
|
|
69
64
|
}
|
|
70
65
|
|
|
71
66
|
func onStateChange(status: Status, offlineAsset: OfflineAsset) {
|
|
72
|
-
print("TPStreamsDownloadModule onStateChange isListening: \(isListening)")
|
|
73
67
|
if isListening {
|
|
74
|
-
print("TPStreamsDownloadModule onStateChange notifyDownloadsChange")
|
|
75
68
|
notifyDownloadsChange()
|
|
76
69
|
}
|
|
77
70
|
}
|
|
78
71
|
|
|
79
72
|
func onDelete(assetId: String) {
|
|
80
|
-
print("TPStreamsDownloadModule onDelete isListening: \(isListening)")
|
|
81
73
|
if isListening {
|
|
82
|
-
print("TPStreamsDownloadModule onDelete notifyDownloadsChange")
|
|
83
74
|
if let offlineAsset = getOfflineAsset(assetId: assetId) {
|
|
84
75
|
notifyDownloadStateChanged(offlineAsset: offlineAsset)
|
|
85
76
|
}
|
|
@@ -88,18 +79,14 @@ class TPStreamsDownloadModule: RCTEventEmitter, TPStreamsDownloadDelegate {
|
|
|
88
79
|
}
|
|
89
80
|
|
|
90
81
|
func onStart(offlineAsset: OfflineAsset) {
|
|
91
|
-
print("TPStreamsDownloadModule onStart isListening: \(isListening)")
|
|
92
82
|
if isListening {
|
|
93
|
-
print("TPStreamsDownloadModule onStart notifyDownloadsChange")
|
|
94
83
|
notifyDownloadStateChanged(offlineAsset: offlineAsset)
|
|
95
84
|
notifyDownloadsChange()
|
|
96
85
|
}
|
|
97
86
|
}
|
|
98
87
|
|
|
99
88
|
func onComplete(offlineAsset: OfflineAsset) {
|
|
100
|
-
print("TPStreamsDownloadModule onComplete isListening: \(isListening)")
|
|
101
89
|
if isListening {
|
|
102
|
-
print("TPStreamsDownloadModule onComplete notifyDownloadsChange")
|
|
103
90
|
notifyDownloadStateChanged(offlineAsset: offlineAsset)
|
|
104
91
|
notifyDownloadsChange()
|
|
105
92
|
}
|
|
@@ -184,12 +184,12 @@ class TPStreamsRNPlayerView: UIView {
|
|
|
184
184
|
TPStreamsDownloadModule.shared?.setAccessTokenDelegate(self)
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
private func parseMetadataJSON(from jsonString: NSString?) -> [String:
|
|
187
|
+
private func parseMetadataJSON(from jsonString: NSString?) -> [String: Any]? {
|
|
188
188
|
guard let metadataString = jsonString as String? else { return nil }
|
|
189
189
|
|
|
190
190
|
guard let data = metadataString.data(using: .utf8) else { return nil }
|
|
191
191
|
do {
|
|
192
|
-
if let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String:
|
|
192
|
+
if let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
|
|
193
193
|
return json
|
|
194
194
|
}
|
|
195
195
|
} catch {
|
|
@@ -7,7 +7,7 @@ export interface DownloadItem {
|
|
|
7
7
|
downloadedBytes: number;
|
|
8
8
|
progressPercentage: number;
|
|
9
9
|
state: string;
|
|
10
|
-
metadata: string
|
|
10
|
+
metadata: Record<string, any>;
|
|
11
11
|
}
|
|
12
12
|
export type DownloadProgressChange = DownloadItem;
|
|
13
13
|
export type DownloadProgressListener = (downloads: DownloadProgressChange[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TPStreamsDownload.d.ts","sourceRoot":"","sources":["../../../src/TPStreamsDownload.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAIxD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAA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B,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7D;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE9D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE/D;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE1D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAElE;AAED,wBAAgB,eAAe,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAEzD"}
|
|
@@ -19,7 +19,7 @@ export interface TPStreamsPlayerProps extends ViewProps {
|
|
|
19
19
|
offlineLicenseExpireTime?: number;
|
|
20
20
|
showDefaultCaptions?: boolean;
|
|
21
21
|
downloadMetadata?: {
|
|
22
|
-
[key: string]:
|
|
22
|
+
[key: string]: any;
|
|
23
23
|
};
|
|
24
24
|
onPlayerStateChanged?: (state: number) => void;
|
|
25
25
|
onIsPlayingChanged?: (isPlaying: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TPStreamsPlayer.d.ts","sourceRoot":"","sources":["../../../src/TPStreamsPlayer.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAc9C,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,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O,CAAC,MAAM,CAAC,CAAC;CACzC;AAGD,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IAC1C,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;IACX,oBAAoB,CAAC,EAAE,CACrB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,KACjC,IAAI,CAAC;CACX;AAED;;;GAGG;AACH,QAAA,MAAM,mBAAmB,qHAyMvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tpstreams",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Video component for TPStreams",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -166,8 +166,5 @@
|
|
|
166
166
|
"languages": "kotlin-objc",
|
|
167
167
|
"type": "fabric-view",
|
|
168
168
|
"version": "0.50.3"
|
|
169
|
-
},
|
|
170
|
-
"dependencies": {
|
|
171
|
-
"react-native-toast-message": "^2.3.3"
|
|
172
169
|
}
|
|
173
170
|
}
|
package/src/TPStreamsPlayer.tsx
CHANGED
|
@@ -40,7 +40,7 @@ export interface TPStreamsPlayerProps extends ViewProps {
|
|
|
40
40
|
enableDownload?: boolean;
|
|
41
41
|
offlineLicenseExpireTime?: number;
|
|
42
42
|
showDefaultCaptions?: boolean;
|
|
43
|
-
downloadMetadata?: { [key: string]:
|
|
43
|
+
downloadMetadata?: { [key: string]: any };
|
|
44
44
|
onPlayerStateChanged?: (state: number) => void;
|
|
45
45
|
onIsPlayingChanged?: (isPlaying: boolean) => void;
|
|
46
46
|
onPlaybackSpeedChanged?: (speed: number) => void;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
-
* once the code is regenerated.
|
|
6
|
-
*
|
|
7
|
-
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
package com.facebook.react.viewmanagers;
|
|
11
|
-
|
|
12
|
-
import android.view.View;
|
|
13
|
-
import androidx.annotation.Nullable;
|
|
14
|
-
import com.facebook.react.bridge.ReadableArray;
|
|
15
|
-
import com.facebook.react.uimanager.BaseViewManager;
|
|
16
|
-
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
17
|
-
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
18
|
-
|
|
19
|
-
public class TPStreamsRNPlayerViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & TPStreamsRNPlayerViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
20
|
-
public TPStreamsRNPlayerViewManagerDelegate(U viewManager) {
|
|
21
|
-
super(viewManager);
|
|
22
|
-
}
|
|
23
|
-
@Override
|
|
24
|
-
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
25
|
-
switch (propName) {
|
|
26
|
-
case "videoId":
|
|
27
|
-
mViewManager.setVideoId(view, value == null ? null : (String) value);
|
|
28
|
-
break;
|
|
29
|
-
case "accessToken":
|
|
30
|
-
mViewManager.setAccessToken(view, value == null ? null : (String) value);
|
|
31
|
-
break;
|
|
32
|
-
case "shouldAutoPlay":
|
|
33
|
-
mViewManager.setShouldAutoPlay(view, value == null ? false : (boolean) value);
|
|
34
|
-
break;
|
|
35
|
-
case "startAt":
|
|
36
|
-
mViewManager.setStartAt(view, value == null ? 0f : ((Double) value).doubleValue());
|
|
37
|
-
break;
|
|
38
|
-
case "enableDownload":
|
|
39
|
-
mViewManager.setEnableDownload(view, value == null ? false : (boolean) value);
|
|
40
|
-
break;
|
|
41
|
-
case "showDefaultCaptions":
|
|
42
|
-
mViewManager.setShowDefaultCaptions(view, value == null ? false : (boolean) value);
|
|
43
|
-
break;
|
|
44
|
-
case "downloadMetadata":
|
|
45
|
-
mViewManager.setDownloadMetadata(view, value == null ? null : (String) value);
|
|
46
|
-
break;
|
|
47
|
-
case "offlineLicenseExpireTime":
|
|
48
|
-
mViewManager.setOfflineLicenseExpireTime(view, value == null ? 0f : ((Double) value).doubleValue());
|
|
49
|
-
break;
|
|
50
|
-
default:
|
|
51
|
-
super.setProperty(view, propName, value);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@Override
|
|
56
|
-
public void receiveCommand(T view, String commandName, @Nullable ReadableArray args) {
|
|
57
|
-
switch (commandName) {
|
|
58
|
-
case "play":
|
|
59
|
-
mViewManager.play(view);
|
|
60
|
-
break;
|
|
61
|
-
case "pause":
|
|
62
|
-
mViewManager.pause(view);
|
|
63
|
-
break;
|
|
64
|
-
case "seekTo":
|
|
65
|
-
mViewManager.seekTo(view, args.getDouble(0));
|
|
66
|
-
break;
|
|
67
|
-
case "setPlaybackSpeed":
|
|
68
|
-
mViewManager.setPlaybackSpeed(view, (float) args.getDouble(0));
|
|
69
|
-
break;
|
|
70
|
-
case "getCurrentPosition":
|
|
71
|
-
mViewManager.getCurrentPosition(view);
|
|
72
|
-
break;
|
|
73
|
-
case "getDuration":
|
|
74
|
-
mViewManager.getDuration(view);
|
|
75
|
-
break;
|
|
76
|
-
case "isPlaying":
|
|
77
|
-
mViewManager.isPlaying(view);
|
|
78
|
-
break;
|
|
79
|
-
case "getPlaybackSpeed":
|
|
80
|
-
mViewManager.getPlaybackSpeed(view);
|
|
81
|
-
break;
|
|
82
|
-
case "setNewAccessToken":
|
|
83
|
-
mViewManager.setNewAccessToken(view, args.getString(0));
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
-
* once the code is regenerated.
|
|
6
|
-
*
|
|
7
|
-
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
package com.facebook.react.viewmanagers;
|
|
11
|
-
|
|
12
|
-
import android.view.View;
|
|
13
|
-
import androidx.annotation.Nullable;
|
|
14
|
-
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
|
|
15
|
-
|
|
16
|
-
public interface TPStreamsRNPlayerViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
|
|
17
|
-
void setVideoId(T view, @Nullable String value);
|
|
18
|
-
void setAccessToken(T view, @Nullable String value);
|
|
19
|
-
void setShouldAutoPlay(T view, boolean value);
|
|
20
|
-
void setStartAt(T view, double value);
|
|
21
|
-
void setEnableDownload(T view, boolean value);
|
|
22
|
-
void setShowDefaultCaptions(T view, boolean value);
|
|
23
|
-
void setDownloadMetadata(T view, @Nullable String value);
|
|
24
|
-
void setOfflineLicenseExpireTime(T view, double value);
|
|
25
|
-
void play(T view);
|
|
26
|
-
void pause(T view);
|
|
27
|
-
void seekTo(T view, double positionMs);
|
|
28
|
-
void setPlaybackSpeed(T view, float speed);
|
|
29
|
-
void getCurrentPosition(T view);
|
|
30
|
-
void getDuration(T view);
|
|
31
|
-
void isPlaying(T view);
|
|
32
|
-
void getPlaybackSpeed(T view);
|
|
33
|
-
void setNewAccessToken(T view, String newToken);
|
|
34
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
#
|
|
3
|
-
# This source code is licensed under the MIT license found in the
|
|
4
|
-
# LICENSE file in the root directory of this source tree.
|
|
5
|
-
|
|
6
|
-
cmake_minimum_required(VERSION 3.13)
|
|
7
|
-
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
-
|
|
9
|
-
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/TPStreamsPlayerViewSpec/*.cpp)
|
|
10
|
-
|
|
11
|
-
add_library(
|
|
12
|
-
react_codegen_TPStreamsPlayerViewSpec
|
|
13
|
-
OBJECT
|
|
14
|
-
${react_codegen_SRCS}
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
target_include_directories(react_codegen_TPStreamsPlayerViewSpec PUBLIC . react/renderer/components/TPStreamsPlayerViewSpec)
|
|
18
|
-
|
|
19
|
-
target_link_libraries(
|
|
20
|
-
react_codegen_TPStreamsPlayerViewSpec
|
|
21
|
-
fbjni
|
|
22
|
-
jsi
|
|
23
|
-
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
-
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
-
reactnative
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
target_compile_options(
|
|
29
|
-
react_codegen_TPStreamsPlayerViewSpec
|
|
30
|
-
PRIVATE
|
|
31
|
-
-DLOG_TAG=\"ReactNative\"
|
|
32
|
-
-fexceptions
|
|
33
|
-
-frtti
|
|
34
|
-
-std=c++20
|
|
35
|
-
-Wall
|
|
36
|
-
)
|
package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec-generated.cpp
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateModuleJniCpp.js
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#include "TPStreamsPlayerViewSpec.h"
|
|
12
|
-
|
|
13
|
-
namespace facebook::react {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
std::shared_ptr<TurboModule> TPStreamsPlayerViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
18
|
-
|
|
19
|
-
return nullptr;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
} // namespace facebook::react
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateModuleJniH.js
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#pragma once
|
|
12
|
-
|
|
13
|
-
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
-
#include <ReactCommon/TurboModule.h>
|
|
15
|
-
#include <jsi/jsi.h>
|
|
16
|
-
|
|
17
|
-
namespace facebook::react {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
JSI_EXPORT
|
|
22
|
-
std::shared_ptr<TurboModule> TPStreamsPlayerViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
23
|
-
|
|
24
|
-
} // namespace facebook::react
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateComponentDescriptorCpp.js
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#include <react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h>
|
|
12
|
-
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
|
-
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
|
-
|
|
15
|
-
namespace facebook::react {
|
|
16
|
-
|
|
17
|
-
void TPStreamsPlayerViewSpec_registerComponentDescriptorsFromCodegen(
|
|
18
|
-
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
-
registry->add(concreteComponentDescriptorProvider<TPStreamsRNPlayerViewComponentDescriptor>());
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
} // namespace facebook::react
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateComponentDescriptorH.js
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#pragma once
|
|
12
|
-
|
|
13
|
-
#include <react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h>
|
|
14
|
-
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
-
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
|
-
|
|
17
|
-
namespace facebook::react {
|
|
18
|
-
|
|
19
|
-
using TPStreamsRNPlayerViewComponentDescriptor = ConcreteComponentDescriptor<TPStreamsRNPlayerViewShadowNode>;
|
|
20
|
-
|
|
21
|
-
void TPStreamsPlayerViewSpec_registerComponentDescriptorsFromCodegen(
|
|
22
|
-
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
-
|
|
24
|
-
} // namespace facebook::react
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateEventEmitterCpp.js
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#include <react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
namespace facebook::react {
|
|
15
|
-
|
|
16
|
-
void TPStreamsRNPlayerViewEventEmitter::onCurrentPosition(OnCurrentPosition $event) const {
|
|
17
|
-
dispatchEvent("currentPosition", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
18
|
-
auto $payload = jsi::Object(runtime);
|
|
19
|
-
$payload.setProperty(runtime, "position", $event.position);
|
|
20
|
-
return $payload;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
void TPStreamsRNPlayerViewEventEmitter::onDuration(OnDuration $event) const {
|
|
26
|
-
dispatchEvent("duration", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
27
|
-
auto $payload = jsi::Object(runtime);
|
|
28
|
-
$payload.setProperty(runtime, "duration", $event.duration);
|
|
29
|
-
return $payload;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
void TPStreamsRNPlayerViewEventEmitter::onIsPlaying(OnIsPlaying $event) const {
|
|
35
|
-
dispatchEvent("isPlaying", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
36
|
-
auto $payload = jsi::Object(runtime);
|
|
37
|
-
$payload.setProperty(runtime, "isPlaying", $event.isPlaying);
|
|
38
|
-
return $payload;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
void TPStreamsRNPlayerViewEventEmitter::onPlaybackSpeed(OnPlaybackSpeed $event) const {
|
|
44
|
-
dispatchEvent("playbackSpeed", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
45
|
-
auto $payload = jsi::Object(runtime);
|
|
46
|
-
$payload.setProperty(runtime, "speed", $event.speed);
|
|
47
|
-
return $payload;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
void TPStreamsRNPlayerViewEventEmitter::onPlayerStateChanged(OnPlayerStateChanged $event) const {
|
|
53
|
-
dispatchEvent("playerStateChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
54
|
-
auto $payload = jsi::Object(runtime);
|
|
55
|
-
$payload.setProperty(runtime, "playbackState", $event.playbackState);
|
|
56
|
-
return $payload;
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
void TPStreamsRNPlayerViewEventEmitter::onIsPlayingChanged(OnIsPlayingChanged $event) const {
|
|
62
|
-
dispatchEvent("isPlayingChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
63
|
-
auto $payload = jsi::Object(runtime);
|
|
64
|
-
$payload.setProperty(runtime, "isPlaying", $event.isPlaying);
|
|
65
|
-
return $payload;
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
void TPStreamsRNPlayerViewEventEmitter::onPlaybackSpeedChanged(OnPlaybackSpeedChanged $event) const {
|
|
71
|
-
dispatchEvent("playbackSpeedChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
72
|
-
auto $payload = jsi::Object(runtime);
|
|
73
|
-
$payload.setProperty(runtime, "speed", $event.speed);
|
|
74
|
-
return $payload;
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
void TPStreamsRNPlayerViewEventEmitter::onIsLoadingChanged(OnIsLoadingChanged $event) const {
|
|
80
|
-
dispatchEvent("isLoadingChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
81
|
-
auto $payload = jsi::Object(runtime);
|
|
82
|
-
$payload.setProperty(runtime, "isLoading", $event.isLoading);
|
|
83
|
-
return $payload;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
void TPStreamsRNPlayerViewEventEmitter::onError(OnError $event) const {
|
|
89
|
-
dispatchEvent("error", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
90
|
-
auto $payload = jsi::Object(runtime);
|
|
91
|
-
$payload.setProperty(runtime, "message", $event.message);
|
|
92
|
-
$payload.setProperty(runtime, "code", $event.code);
|
|
93
|
-
$payload.setProperty(runtime, "details", $event.details);
|
|
94
|
-
return $payload;
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
void TPStreamsRNPlayerViewEventEmitter::onAccessTokenExpired(OnAccessTokenExpired $event) const {
|
|
100
|
-
dispatchEvent("accessTokenExpired", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
101
|
-
auto $payload = jsi::Object(runtime);
|
|
102
|
-
$payload.setProperty(runtime, "videoId", $event.videoId);
|
|
103
|
-
return $payload;
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
} // namespace facebook::react
|