react-native-tpstreams 0.2.10 → 0.2.13
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 +135 -3
- package/{Tpstreams.podspec → TPStreamsRNPlayerView.podspec} +7 -2
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerDelegate.java +78 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerInterface.java +31 -0
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
- package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec-generated.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.cpp +98 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h +75 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.cpp +30 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.h +32 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h +32 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.cpp +16 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.h +29 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI-generated.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI.h +19 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/tpstreams/TPStreamsDownloadModule.kt +128 -0
- package/android/src/main/java/com/tpstreams/TPStreamsRNPackage.kt +1 -0
- package/android/src/main/java/com/tpstreams/TPStreamsRNPlayerView.kt +4 -0
- package/android/src/main/java/com/tpstreams/TPStreamsRNPlayerViewManager.kt +5 -0
- package/ios/TPStreamsDownloadModule.mm +7 -0
- package/ios/TPStreamsDownloadModule.swift +13 -0
- package/ios/TPStreamsModule.mm +7 -0
- package/ios/TPStreamsModule.swift +17 -0
- package/ios/TPStreamsRNPlayerView.h +14 -0
- package/ios/TPStreamsRNPlayerView.mm +52 -0
- package/ios/TPStreamsRNPlayerViewManager.mm +18 -0
- package/lib/module/TPStreamsDownload.js +31 -0
- package/lib/module/TPStreamsDownload.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/TPStreamsDownload.d.ts +18 -0
- package/lib/typescript/src/TPStreamsDownload.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/TPStreamsDownload.tsx +45 -0
- package/src/index.tsx +12 -0
- package/ios/TpstreamsView.h +0 -14
- package/ios/TpstreamsView.mm +0 -71
- package/ios/TpstreamsViewManager.mm +0 -19
|
@@ -0,0 +1,32 @@
|
|
|
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: GenerateShadowNodeH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h>
|
|
14
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/Props.h>
|
|
15
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/States.h>
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <jsi/jsi.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook::react {
|
|
20
|
+
|
|
21
|
+
JSI_EXPORT extern const char TPStreamsRNPlayerViewComponentName[];
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* `ShadowNode` for <TPStreamsRNPlayerView> component.
|
|
25
|
+
*/
|
|
26
|
+
using TPStreamsRNPlayerViewShadowNode = ConcreteViewShadowNode<
|
|
27
|
+
TPStreamsRNPlayerViewComponentName,
|
|
28
|
+
TPStreamsRNPlayerViewProps,
|
|
29
|
+
TPStreamsRNPlayerViewEventEmitter,
|
|
30
|
+
TPStreamsRNPlayerViewState>;
|
|
31
|
+
|
|
32
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,16 @@
|
|
|
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: GenerateStateCpp.js
|
|
9
|
+
*/
|
|
10
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/States.h>
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,29 @@
|
|
|
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: GenerateStateH.js
|
|
8
|
+
*/
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#ifdef ANDROID
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
class TPStreamsRNPlayerViewState {
|
|
18
|
+
public:
|
|
19
|
+
TPStreamsRNPlayerViewState() = default;
|
|
20
|
+
|
|
21
|
+
#ifdef ANDROID
|
|
22
|
+
TPStreamsRNPlayerViewState(TPStreamsRNPlayerViewState const &previousState, folly::dynamic data){};
|
|
23
|
+
folly::dynamic getDynamic() const {
|
|
24
|
+
return {};
|
|
25
|
+
};
|
|
26
|
+
#endif
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
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: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "TPStreamsPlayerViewSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,19 @@
|
|
|
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: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
} // namespace facebook::react
|
package/android/build.gradle
CHANGED
|
@@ -82,7 +82,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
82
82
|
dependencies {
|
|
83
83
|
implementation "com.facebook.react:react-android"
|
|
84
84
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
85
|
-
implementation 'com.github.testpress:TPStreamsAndroidPlayer:1.0.
|
|
85
|
+
implementation 'com.github.testpress:TPStreamsAndroidPlayer:1.0.6'
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
react {
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
package com.tpstreams
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import com.facebook.react.bridge.Promise
|
|
5
|
+
import com.facebook.react.bridge.Arguments
|
|
6
|
+
import com.facebook.react.bridge.ReactMethod
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
9
|
+
import com.tpstreams.player.download.DownloadClient
|
|
10
|
+
import com.tpstreams.player.download.DownloadItem
|
|
11
|
+
|
|
12
|
+
class TPStreamsDownloadModule(private val reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
13
|
+
|
|
14
|
+
private val downloadClient: DownloadClient by lazy {
|
|
15
|
+
DownloadClient.getInstance(reactContext)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override fun getName(): String {
|
|
19
|
+
return "TPStreamsDownload"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@ReactMethod
|
|
23
|
+
fun pauseDownload(videoId: String, promise: Promise) {
|
|
24
|
+
try {
|
|
25
|
+
downloadClient.pauseDownload(videoId)
|
|
26
|
+
promise.resolve(null)
|
|
27
|
+
} catch (e: Exception) {
|
|
28
|
+
Log.e(TAG, "Error pausing download: ${e.message}", e)
|
|
29
|
+
promise.reject("DOWNLOAD_PAUSE_ERROR", e.message, e)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@ReactMethod
|
|
34
|
+
fun resumeDownload(videoId: String, promise: Promise) {
|
|
35
|
+
try {
|
|
36
|
+
downloadClient.resumeDownload(videoId)
|
|
37
|
+
promise.resolve(null)
|
|
38
|
+
} catch (e: Exception) {
|
|
39
|
+
Log.e(TAG, "Error resuming download: ${e.message}", e)
|
|
40
|
+
promise.reject("DOWNLOAD_RESUME_ERROR", e.message, e)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@ReactMethod
|
|
45
|
+
fun removeDownload(videoId: String, promise: Promise) {
|
|
46
|
+
try {
|
|
47
|
+
downloadClient.removeDownload(videoId)
|
|
48
|
+
promise.resolve(null)
|
|
49
|
+
} catch (e: Exception) {
|
|
50
|
+
Log.e(TAG, "Error removing download: ${e.message}", e)
|
|
51
|
+
promise.reject("DOWNLOAD_REMOVE_ERROR", e.message, e)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@ReactMethod
|
|
56
|
+
fun isDownloaded(videoId: String, promise: Promise) {
|
|
57
|
+
try {
|
|
58
|
+
val isDownloaded = downloadClient.isDownloaded(videoId)
|
|
59
|
+
promise.resolve(isDownloaded)
|
|
60
|
+
} catch (e: Exception) {
|
|
61
|
+
Log.e(TAG, "Error checking if downloaded: ${e.message}", e)
|
|
62
|
+
promise.reject("DOWNLOAD_CHECK_ERROR", e.message, e)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@ReactMethod
|
|
67
|
+
fun isDownloading(videoId: String, promise: Promise) {
|
|
68
|
+
try {
|
|
69
|
+
val isDownloading = downloadClient.isDownloading(videoId)
|
|
70
|
+
promise.resolve(isDownloading)
|
|
71
|
+
} catch (e: Exception) {
|
|
72
|
+
Log.e(TAG, "Error checking if downloading: ${e.message}", e)
|
|
73
|
+
promise.reject("DOWNLOAD_CHECK_ERROR", e.message, e)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@ReactMethod
|
|
78
|
+
fun isPaused(videoId: String, promise: Promise) {
|
|
79
|
+
try {
|
|
80
|
+
val isPaused = downloadClient.isPaused(videoId)
|
|
81
|
+
promise.resolve(isPaused)
|
|
82
|
+
} catch (e: Exception) {
|
|
83
|
+
Log.e(TAG, "Error checking if paused: ${e.message}", e)
|
|
84
|
+
promise.reject("DOWNLOAD_CHECK_ERROR", e.message, e)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@ReactMethod
|
|
89
|
+
fun getDownloadStatus(videoId: String, promise: Promise) {
|
|
90
|
+
try {
|
|
91
|
+
val status = downloadClient.getDownloadStatus(videoId)
|
|
92
|
+
promise.resolve(status)
|
|
93
|
+
} catch (e: Exception) {
|
|
94
|
+
Log.e(TAG, "Error getting download status: ${e.message}", e)
|
|
95
|
+
promise.reject("DOWNLOAD_STATUS_ERROR", e.message, e)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@ReactMethod
|
|
100
|
+
fun getAllDownloads(promise: Promise) {
|
|
101
|
+
try {
|
|
102
|
+
val downloadItems = downloadClient.getAllDownloadItems()
|
|
103
|
+
val result = Arguments.createArray()
|
|
104
|
+
|
|
105
|
+
for (item in downloadItems) {
|
|
106
|
+
val map = Arguments.createMap()
|
|
107
|
+
map.putString("videoId", item.assetId)
|
|
108
|
+
map.putString("title", item.title)
|
|
109
|
+
item.thumbnailUrl?.let { map.putString("thumbnailUrl", it) }
|
|
110
|
+
map.putDouble("totalBytes", item.totalBytes.toDouble())
|
|
111
|
+
map.putDouble("downloadedBytes", item.downloadedBytes.toDouble())
|
|
112
|
+
map.putDouble("progressPercentage", item.progressPercentage.toDouble())
|
|
113
|
+
map.putString("state", downloadClient.getDownloadStatus(item.assetId))
|
|
114
|
+
|
|
115
|
+
result.pushMap(map)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
promise.resolve(result)
|
|
119
|
+
} catch (e: Exception) {
|
|
120
|
+
Log.e(TAG, "Error getting all download items: ${e.message}", e)
|
|
121
|
+
promise.reject("DOWNLOAD_ITEMS_ERROR", e.message, e)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
companion object {
|
|
126
|
+
private const val TAG = "TPStreamsDownloadModule"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -16,6 +16,7 @@ class TPStreamsRNPackage : ReactPackage {
|
|
|
16
16
|
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
17
17
|
val modules: MutableList<NativeModule> = ArrayList()
|
|
18
18
|
modules.add(TPStreamsRNModule(reactContext))
|
|
19
|
+
modules.add(TPStreamsDownloadModule(reactContext))
|
|
19
20
|
return modules
|
|
20
21
|
}
|
|
21
22
|
}
|
|
@@ -178,6 +178,10 @@ class TPStreamsRNPlayerView(context: ThemedReactContext) : FrameLayout(context)
|
|
|
178
178
|
|
|
179
179
|
override fun onDetachedFromWindow() {
|
|
180
180
|
super.onDetachedFromWindow()
|
|
181
|
+
player?.pause()
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
fun releasePlayer() {
|
|
181
185
|
try {
|
|
182
186
|
player?.release()
|
|
183
187
|
} catch (e: Exception) {
|
|
@@ -119,4 +119,9 @@ class TPStreamsRNPlayerViewManager : SimpleViewManager<TPStreamsRNPlayerView>(),
|
|
|
119
119
|
super.onAfterUpdateTransaction(view)
|
|
120
120
|
view.tryCreatePlayer()
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
override fun onDropViewInstance(view: TPStreamsRNPlayerView) {
|
|
124
|
+
super.onDropViewInstance(view)
|
|
125
|
+
view.releasePlayer()
|
|
126
|
+
}
|
|
122
127
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
|
|
4
|
+
@objc(TPStreamsDownload)
|
|
5
|
+
class TPStreamsDownloadModule: NSObject {
|
|
6
|
+
|
|
7
|
+
@objc
|
|
8
|
+
static func requiresMainQueueSetup() -> Bool {
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Download functionality will be implemented in future commits
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
|
|
4
|
+
@objc(TPStreams)
|
|
5
|
+
class TPStreamsModule: NSObject {
|
|
6
|
+
|
|
7
|
+
@objc
|
|
8
|
+
static func requiresMainQueueSetup() -> Bool {
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@objc
|
|
13
|
+
func initialize(_ organizationId: String) {
|
|
14
|
+
// Basic initialization - will be implemented in future commits
|
|
15
|
+
print("TPStreams initialized with organization ID: \(organizationId)")
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#import <React/RCTViewComponentView.h>
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
3
|
+
|
|
4
|
+
#ifndef TPStreamsRNPlayerViewNativeComponent_h
|
|
5
|
+
#define TPStreamsRNPlayerViewNativeComponent_h
|
|
6
|
+
|
|
7
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
8
|
+
|
|
9
|
+
@interface TPStreamsRNPlayerView : RCTViewComponentView
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_END
|
|
13
|
+
|
|
14
|
+
#endif /* TPStreamsRNPlayerViewNativeComponent_h */
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#import "TPStreamsRNPlayerView.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/TPStreamsPlayerViewSpec/Props.h>
|
|
6
|
+
#import <react/renderer/components/TPStreamsPlayerViewSpec/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
9
|
+
|
|
10
|
+
using namespace facebook::react;
|
|
11
|
+
|
|
12
|
+
@interface TPStreamsRNPlayerView () <RCTTPStreamsRNPlayerViewViewProtocol>
|
|
13
|
+
@end
|
|
14
|
+
|
|
15
|
+
@implementation TPStreamsRNPlayerView {
|
|
16
|
+
UIView * _view;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
20
|
+
{
|
|
21
|
+
return concreteComponentDescriptorProvider<TPStreamsRNPlayerViewComponentDescriptor>();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
25
|
+
{
|
|
26
|
+
if (self = [super initWithFrame:frame]) {
|
|
27
|
+
static const auto defaultProps = std::make_shared<const TPStreamsRNPlayerViewProps>();
|
|
28
|
+
_props = defaultProps;
|
|
29
|
+
|
|
30
|
+
_view = [[UIView alloc] init];
|
|
31
|
+
self.contentView = _view;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return self;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
38
|
+
{
|
|
39
|
+
const auto &oldViewProps = *std::static_pointer_cast<TPStreamsRNPlayerViewProps const>(_props);
|
|
40
|
+
const auto &newViewProps = *std::static_pointer_cast<TPStreamsRNPlayerViewProps const>(props);
|
|
41
|
+
|
|
42
|
+
// Process props update here when needed
|
|
43
|
+
|
|
44
|
+
[super updateProps:props oldProps:oldProps];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
Class<RCTComponentViewProtocol> TPStreamsRNPlayerViewCls(void)
|
|
48
|
+
{
|
|
49
|
+
return TPStreamsRNPlayerView.class;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#import <React/RCTViewManager.h>
|
|
2
|
+
#import <React/RCTUIManager.h>
|
|
3
|
+
#import "RCTBridge.h"
|
|
4
|
+
#import "TPStreamsRNPlayerView.h"
|
|
5
|
+
|
|
6
|
+
@interface TPStreamsRNPlayerViewManager : RCTViewManager
|
|
7
|
+
@end
|
|
8
|
+
|
|
9
|
+
@implementation TPStreamsRNPlayerViewManager
|
|
10
|
+
|
|
11
|
+
RCT_EXPORT_MODULE(TPStreamsRNPlayerView)
|
|
12
|
+
|
|
13
|
+
- (UIView *)view
|
|
14
|
+
{
|
|
15
|
+
return [TPStreamsRNPlayerView new];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeModules } from 'react-native';
|
|
4
|
+
const {
|
|
5
|
+
TPStreamsDownload
|
|
6
|
+
} = NativeModules;
|
|
7
|
+
export function pauseDownload(videoId) {
|
|
8
|
+
return TPStreamsDownload.pauseDownload(videoId);
|
|
9
|
+
}
|
|
10
|
+
export function resumeDownload(videoId) {
|
|
11
|
+
return TPStreamsDownload.resumeDownload(videoId);
|
|
12
|
+
}
|
|
13
|
+
export function removeDownload(videoId) {
|
|
14
|
+
return TPStreamsDownload.removeDownload(videoId);
|
|
15
|
+
}
|
|
16
|
+
export function isDownloaded(videoId) {
|
|
17
|
+
return TPStreamsDownload.isDownloaded(videoId);
|
|
18
|
+
}
|
|
19
|
+
export function isDownloading(videoId) {
|
|
20
|
+
return TPStreamsDownload.isDownloading(videoId);
|
|
21
|
+
}
|
|
22
|
+
export function isPaused(videoId) {
|
|
23
|
+
return TPStreamsDownload.isPaused(videoId);
|
|
24
|
+
}
|
|
25
|
+
export function getDownloadStatus(videoId) {
|
|
26
|
+
return TPStreamsDownload.getDownloadStatus(videoId);
|
|
27
|
+
}
|
|
28
|
+
export function getAllDownloads() {
|
|
29
|
+
return TPStreamsDownload.getAllDownloads();
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=TPStreamsDownload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","TPStreamsDownload","pauseDownload","videoId","resumeDownload","removeDownload","isDownloaded","isDownloading","isPaused","getDownloadStatus","getAllDownloads"],"sourceRoot":"../../src","sources":["TPStreamsDownload.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,MAAM;EAAEC;AAAkB,CAAC,GAAGD,aAAa;AAY3C,OAAO,SAASE,aAAaA,CAACC,OAAe,EAAiB;EAC5D,OAAOF,iBAAiB,CAACC,aAAa,CAACC,OAAO,CAAC;AACjD;AAEA,OAAO,SAASC,cAAcA,CAACD,OAAe,EAAiB;EAC7D,OAAOF,iBAAiB,CAACG,cAAc,CAACD,OAAO,CAAC;AAClD;AAEA,OAAO,SAASE,cAAcA,CAACF,OAAe,EAAiB;EAC7D,OAAOF,iBAAiB,CAACI,cAAc,CAACF,OAAO,CAAC;AAClD;AAEA,OAAO,SAASG,YAAYA,CAACH,OAAe,EAAoB;EAC9D,OAAOF,iBAAiB,CAACK,YAAY,CAACH,OAAO,CAAC;AAChD;AAEA,OAAO,SAASI,aAAaA,CAACJ,OAAe,EAAoB;EAC/D,OAAOF,iBAAiB,CAACM,aAAa,CAACJ,OAAO,CAAC;AACjD;AAEA,OAAO,SAASK,QAAQA,CAACL,OAAe,EAAoB;EAC1D,OAAOF,iBAAiB,CAACO,QAAQ,CAACL,OAAO,CAAC;AAC5C;AAEA,OAAO,SAASM,iBAAiBA,CAACN,OAAe,EAAmB;EAClE,OAAOF,iBAAiB,CAACQ,iBAAiB,CAACN,OAAO,CAAC;AACrD;AAEA,OAAO,SAASO,eAAeA,CAAA,EAA4B;EACzD,OAAOT,iBAAiB,CAACS,eAAe,CAAC,CAAC;AAC5C","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './TPStreamsPlayerViewNativeComponent';
|
|
|
7
7
|
|
|
8
8
|
// Export the wrapper component as TPStreamsPlayerView
|
|
9
9
|
export { default as TPStreamsPlayerView } from "./TPStreamsPlayer.js";
|
|
10
|
+
export { pauseDownload, resumeDownload, removeDownload, isDownloaded, isDownloading, isPaused, getDownloadStatus, getAllDownloads } from "./TPStreamsDownload.js";
|
|
10
11
|
const TPStreamsModule = NativeModules.TPStreams;
|
|
11
12
|
export const TPStreams = {
|
|
12
13
|
initialize: organizationId => {
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","default","TPStreamsPlayerNative","TPStreamsPlayerView","TPStreamsModule","TPStreams","initialize","organizationId"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAC5C;AACA,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,sCAAsC;AACvF,cAAc,sCAAsC;;AAEpD;AACA,SAASD,OAAO,IAAIE,mBAAmB,QAAQ,sBAAmB;AAGlE,MAAMC,eAAe,
|
|
1
|
+
{"version":3,"names":["NativeModules","default","TPStreamsPlayerNative","TPStreamsPlayerView","pauseDownload","resumeDownload","removeDownload","isDownloaded","isDownloading","isPaused","getDownloadStatus","getAllDownloads","TPStreamsModule","TPStreams","initialize","organizationId"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAC5C;AACA,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,sCAAsC;AACvF,cAAc,sCAAsC;;AAEpD;AACA,SAASD,OAAO,IAAIE,mBAAmB,QAAQ,sBAAmB;AAGlE,SACEC,aAAa,EACbC,cAAc,EACdC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,QAEV,wBAAqB;AAE5B,MAAMC,eAAe,GAAGZ,aAAa,CAACa,SAAS;AAE/C,OAAO,MAAMA,SAAS,GAAG;EACvBC,UAAU,EAAGC,cAAsB,IAAW;IAC5CH,eAAe,CAACE,UAAU,CAACC,cAAc,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface DownloadItem {
|
|
2
|
+
videoId: string;
|
|
3
|
+
title: string;
|
|
4
|
+
thumbnailUrl?: string;
|
|
5
|
+
totalBytes: number;
|
|
6
|
+
downloadedBytes: number;
|
|
7
|
+
progressPercentage: number;
|
|
8
|
+
state: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function pauseDownload(videoId: string): Promise<void>;
|
|
11
|
+
export declare function resumeDownload(videoId: string): Promise<void>;
|
|
12
|
+
export declare function removeDownload(videoId: string): Promise<void>;
|
|
13
|
+
export declare function isDownloaded(videoId: string): Promise<boolean>;
|
|
14
|
+
export declare function isDownloading(videoId: string): Promise<boolean>;
|
|
15
|
+
export declare function isPaused(videoId: string): Promise<boolean>;
|
|
16
|
+
export declare function getDownloadStatus(videoId: string): Promise<string>;
|
|
17
|
+
export declare function getAllDownloads(): Promise<DownloadItem[]>;
|
|
18
|
+
//# sourceMappingURL=TPStreamsDownload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TPStreamsDownload.d.ts","sourceRoot":"","sources":["../../../src/TPStreamsDownload.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,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"}
|
|
@@ -2,6 +2,7 @@ export { default as TPStreamsPlayerNative } from './TPStreamsPlayerViewNativeCom
|
|
|
2
2
|
export * from './TPStreamsPlayerViewNativeComponent';
|
|
3
3
|
export { default as TPStreamsPlayerView } from './TPStreamsPlayer';
|
|
4
4
|
export type { TPStreamsPlayerRef } from './TPStreamsPlayer';
|
|
5
|
+
export { pauseDownload, resumeDownload, removeDownload, isDownloaded, isDownloading, isPaused, getDownloadStatus, getAllDownloads, type DownloadItem, } from './TPStreamsDownload';
|
|
5
6
|
export declare const TPStreams: {
|
|
6
7
|
initialize: (organizationId: string) => void;
|
|
7
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACxF,cAAc,sCAAsC,CAAC;AAGrD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACxF,cAAc,sCAAsC,CAAC;AAGrD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,KAAK,YAAY,GAClB,MAAM,qBAAqB,CAAC;AAI7B,eAAO,MAAM,SAAS;iCACS,MAAM,KAAG,IAAI;CAG3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tpstreams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "Video component for TPStreams",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
},
|
|
158
158
|
"ios": {
|
|
159
159
|
"componentProvider": {
|
|
160
|
-
"TPStreamsPlayerView": "
|
|
160
|
+
"TPStreamsPlayerView": "TPStreamsRNPlayerView"
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
},
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const { TPStreamsDownload } = NativeModules;
|
|
4
|
+
|
|
5
|
+
export interface DownloadItem {
|
|
6
|
+
videoId: string;
|
|
7
|
+
title: string;
|
|
8
|
+
thumbnailUrl?: string;
|
|
9
|
+
totalBytes: number;
|
|
10
|
+
downloadedBytes: number;
|
|
11
|
+
progressPercentage: number;
|
|
12
|
+
state: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function pauseDownload(videoId: string): Promise<void> {
|
|
16
|
+
return TPStreamsDownload.pauseDownload(videoId);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function resumeDownload(videoId: string): Promise<void> {
|
|
20
|
+
return TPStreamsDownload.resumeDownload(videoId);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function removeDownload(videoId: string): Promise<void> {
|
|
24
|
+
return TPStreamsDownload.removeDownload(videoId);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function isDownloaded(videoId: string): Promise<boolean> {
|
|
28
|
+
return TPStreamsDownload.isDownloaded(videoId);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function isDownloading(videoId: string): Promise<boolean> {
|
|
32
|
+
return TPStreamsDownload.isDownloading(videoId);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function isPaused(videoId: string): Promise<boolean> {
|
|
36
|
+
return TPStreamsDownload.isPaused(videoId);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getDownloadStatus(videoId: string): Promise<string> {
|
|
40
|
+
return TPStreamsDownload.getDownloadStatus(videoId);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getAllDownloads(): Promise<DownloadItem[]> {
|
|
44
|
+
return TPStreamsDownload.getAllDownloads();
|
|
45
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -7,6 +7,18 @@ export * from './TPStreamsPlayerViewNativeComponent';
|
|
|
7
7
|
export { default as TPStreamsPlayerView } from './TPStreamsPlayer';
|
|
8
8
|
export type { TPStreamsPlayerRef } from './TPStreamsPlayer';
|
|
9
9
|
|
|
10
|
+
export {
|
|
11
|
+
pauseDownload,
|
|
12
|
+
resumeDownload,
|
|
13
|
+
removeDownload,
|
|
14
|
+
isDownloaded,
|
|
15
|
+
isDownloading,
|
|
16
|
+
isPaused,
|
|
17
|
+
getDownloadStatus,
|
|
18
|
+
getAllDownloads,
|
|
19
|
+
type DownloadItem,
|
|
20
|
+
} from './TPStreamsDownload';
|
|
21
|
+
|
|
10
22
|
const TPStreamsModule = NativeModules.TPStreams;
|
|
11
23
|
|
|
12
24
|
export const TPStreams = {
|
package/ios/TpstreamsView.h
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#import <React/RCTViewComponentView.h>
|
|
2
|
-
#import <UIKit/UIKit.h>
|
|
3
|
-
|
|
4
|
-
#ifndef TpstreamsViewNativeComponent_h
|
|
5
|
-
#define TpstreamsViewNativeComponent_h
|
|
6
|
-
|
|
7
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
8
|
-
|
|
9
|
-
@interface TpstreamsView : RCTViewComponentView
|
|
10
|
-
@end
|
|
11
|
-
|
|
12
|
-
NS_ASSUME_NONNULL_END
|
|
13
|
-
|
|
14
|
-
#endif /* TpstreamsViewNativeComponent_h */
|