react-native-tpstreams 1.1.9 → 1.1.11

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.
Files changed (37) hide show
  1. package/TPStreamsRNPlayerView.podspec +1 -1
  2. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerDelegate.java +87 -0
  3. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerInterface.java +34 -0
  4. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
  5. package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec-generated.cpp +22 -0
  6. package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec.h +24 -0
  7. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.cpp +22 -0
  8. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h +24 -0
  9. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.cpp +107 -0
  10. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h +81 -0
  11. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.cpp +32 -0
  12. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.h +34 -0
  13. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.cpp +17 -0
  14. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h +32 -0
  15. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.cpp +16 -0
  16. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.h +29 -0
  17. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI-generated.cpp +17 -0
  18. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI.h +19 -0
  19. package/android/gradle.properties +1 -1
  20. package/android/src/main/java/com/tpstreams/JsonUtils.kt +14 -1
  21. package/android/src/main/java/com/tpstreams/TPStreamsDownloadModule.kt +102 -15
  22. package/android/src/main/java/com/tpstreams/TPStreamsRNPlayerViewManager.kt +1 -14
  23. package/ios/TPStreamsDownloadModule.mm +7 -0
  24. package/ios/TPStreamsDownloadModule.swift +67 -38
  25. package/lib/module/TPStreamsDownload.js +16 -2
  26. package/lib/module/TPStreamsDownload.js.map +1 -1
  27. package/lib/module/index.js +1 -1
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/typescript/src/TPStreamsDownload.d.ts +8 -1
  30. package/lib/typescript/src/TPStreamsDownload.d.ts.map +1 -1
  31. package/lib/typescript/src/TPStreamsPlayerViewNativeComponent.d.ts +1 -0
  32. package/lib/typescript/src/TPStreamsPlayerViewNativeComponent.d.ts.map +1 -1
  33. package/lib/typescript/src/index.d.ts +1 -1
  34. package/lib/typescript/src/index.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/TPStreamsDownload.tsx +39 -4
  37. package/src/index.tsx +7 -0
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
21
21
  'DEFINES_MODULE' => 'YES',
22
22
  'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES'
23
23
  }
24
- s.dependency "TPStreamsSDK" , "1.2.16"
24
+ s.dependency "TPStreamsSDK" , "1.2.23"
25
25
 
26
26
 
27
27
  # Ensure the module is not built as a framework to avoid bridging header conflicts
@@ -0,0 +1,87 @@
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
+ }
@@ -0,0 +1,34 @@
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
+ }
@@ -0,0 +1,36 @@
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
+ )
@@ -0,0 +1,22 @@
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 &params) {
18
+
19
+ return nullptr;
20
+ }
21
+
22
+ } // namespace facebook::react
@@ -0,0 +1,24 @@
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 &params);
23
+
24
+ } // namespace facebook::react
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,24 @@
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
@@ -0,0 +1,107 @@
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
@@ -0,0 +1,81 @@
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: GenerateEventEmitterH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewEventEmitter.h>
13
+
14
+
15
+ namespace facebook::react {
16
+ class TPStreamsRNPlayerViewEventEmitter : public ViewEventEmitter {
17
+ public:
18
+ using ViewEventEmitter::ViewEventEmitter;
19
+
20
+ struct OnCurrentPosition {
21
+ double position;
22
+ };
23
+
24
+ struct OnDuration {
25
+ double duration;
26
+ };
27
+
28
+ struct OnIsPlaying {
29
+ bool isPlaying;
30
+ };
31
+
32
+ struct OnPlaybackSpeed {
33
+ Float speed;
34
+ };
35
+
36
+ struct OnPlayerStateChanged {
37
+ int playbackState;
38
+ };
39
+
40
+ struct OnIsPlayingChanged {
41
+ bool isPlaying;
42
+ };
43
+
44
+ struct OnPlaybackSpeedChanged {
45
+ double speed;
46
+ };
47
+
48
+ struct OnIsLoadingChanged {
49
+ bool isLoading;
50
+ };
51
+
52
+ struct OnError {
53
+ std::string message;
54
+ int code;
55
+ std::string details;
56
+ };
57
+
58
+ struct OnAccessTokenExpired {
59
+ std::string videoId;
60
+ };
61
+ void onCurrentPosition(OnCurrentPosition value) const;
62
+
63
+ void onDuration(OnDuration value) const;
64
+
65
+ void onIsPlaying(OnIsPlaying value) const;
66
+
67
+ void onPlaybackSpeed(OnPlaybackSpeed value) const;
68
+
69
+ void onPlayerStateChanged(OnPlayerStateChanged value) const;
70
+
71
+ void onIsPlayingChanged(OnIsPlayingChanged value) const;
72
+
73
+ void onPlaybackSpeedChanged(OnPlaybackSpeedChanged value) const;
74
+
75
+ void onIsLoadingChanged(OnIsLoadingChanged value) const;
76
+
77
+ void onError(OnError value) const;
78
+
79
+ void onAccessTokenExpired(OnAccessTokenExpired value) const;
80
+ };
81
+ } // namespace facebook::react
@@ -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: GeneratePropsCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/TPStreamsPlayerViewSpec/Props.h>
12
+ #include <react/renderer/core/PropsParserContext.h>
13
+ #include <react/renderer/core/propsConversions.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ TPStreamsRNPlayerViewProps::TPStreamsRNPlayerViewProps(
18
+ const PropsParserContext &context,
19
+ const TPStreamsRNPlayerViewProps &sourceProps,
20
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
21
+
22
+ videoId(convertRawProp(context, rawProps, "videoId", sourceProps.videoId, {})),
23
+ accessToken(convertRawProp(context, rawProps, "accessToken", sourceProps.accessToken, {})),
24
+ shouldAutoPlay(convertRawProp(context, rawProps, "shouldAutoPlay", sourceProps.shouldAutoPlay, {false})),
25
+ startAt(convertRawProp(context, rawProps, "startAt", sourceProps.startAt, {0.0})),
26
+ enableDownload(convertRawProp(context, rawProps, "enableDownload", sourceProps.enableDownload, {false})),
27
+ showDefaultCaptions(convertRawProp(context, rawProps, "showDefaultCaptions", sourceProps.showDefaultCaptions, {false})),
28
+ downloadMetadata(convertRawProp(context, rawProps, "downloadMetadata", sourceProps.downloadMetadata, {})),
29
+ offlineLicenseExpireTime(convertRawProp(context, rawProps, "offlineLicenseExpireTime", sourceProps.offlineLicenseExpireTime, {0.0}))
30
+ {}
31
+
32
+ } // namespace facebook::react
@@ -0,0 +1,34 @@
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: GeneratePropsH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewProps.h>
13
+ #include <react/renderer/core/PropsParserContext.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ class TPStreamsRNPlayerViewProps final : public ViewProps {
18
+ public:
19
+ TPStreamsRNPlayerViewProps() = default;
20
+ TPStreamsRNPlayerViewProps(const PropsParserContext& context, const TPStreamsRNPlayerViewProps &sourceProps, const RawProps &rawProps);
21
+
22
+ #pragma mark - Props
23
+
24
+ std::string videoId{};
25
+ std::string accessToken{};
26
+ bool shouldAutoPlay{false};
27
+ double startAt{0.0};
28
+ bool enableDownload{false};
29
+ bool showDefaultCaptions{false};
30
+ std::string downloadMetadata{};
31
+ double offlineLicenseExpireTime{0.0};
32
+ };
33
+
34
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
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: GenerateShadowNodeCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h>
12
+
13
+ namespace facebook::react {
14
+
15
+ extern const char TPStreamsRNPlayerViewComponentName[] = "TPStreamsRNPlayerView";
16
+
17
+ } // namespace facebook::react
@@ -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
@@ -3,4 +3,4 @@ Tpstreams_minSdkVersion=24
3
3
  Tpstreams_targetSdkVersion=34
4
4
  Tpstreams_compileSdkVersion=35
5
5
  Tpstreams_ndkVersion=27.1.12297006
6
- Tpstreams_tpstreamsAndroidPlayerVersion=1.1.8
6
+ Tpstreams_tpstreamsAndroidPlayerVersion=1.1.9
@@ -1,5 +1,6 @@
1
1
  package com.tpstreams
2
2
 
3
+ import org.json.JSONException
3
4
  import org.json.JSONObject
4
5
 
5
6
  object JsonUtils {
@@ -43,4 +44,16 @@ object JsonUtils {
43
44
  }
44
45
  return map
45
46
  }
46
- }
47
+
48
+ fun jsonStringToMap(jsonString: String?): Map<String, String>? {
49
+ if (jsonString.isNullOrEmpty()) return null
50
+ return try {
51
+ val jsonObject = JSONObject(jsonString)
52
+ jsonObject.keys()
53
+ .asSequence()
54
+ .associate { it to jsonObject.getString(it) }
55
+ } catch (e: JSONException) {
56
+ null
57
+ }
58
+ }
59
+ }
@@ -6,6 +6,7 @@ import com.facebook.react.bridge.Arguments
6
6
  import com.facebook.react.bridge.ReactMethod
7
7
  import com.facebook.react.bridge.ReactApplicationContext
8
8
  import com.facebook.react.bridge.ReactContextBaseJavaModule
9
+ import com.facebook.react.bridge.ReadableMap
9
10
  import com.facebook.react.bridge.WritableMap
10
11
  import com.facebook.react.modules.core.DeviceEventManagerModule
11
12
  import com.tpstreams.player.download.DownloadClient
@@ -23,6 +24,37 @@ class TPStreamsDownloadModule(private val reactContext: ReactApplicationContext)
23
24
  return "TPStreamsDownload"
24
25
  }
25
26
 
27
+ @ReactMethod
28
+ fun startDownload(
29
+ videoId: String,
30
+ accessToken: String,
31
+ resolution: String?,
32
+ metadata: ReadableMap?,
33
+ promise: Promise
34
+ ) {
35
+ try {
36
+ val metadataString = metadata?.let { org.json.JSONObject(it.toHashMap()).toString() }
37
+ val metadataMap = JsonUtils.jsonStringToMap(metadataString)
38
+
39
+ val activity = currentActivity ?: run {
40
+ promise.reject("DOWNLOAD_START_ERROR", "No current activity available")
41
+ return
42
+ }
43
+
44
+ downloadClient.startDownload(
45
+ activity,
46
+ videoId,
47
+ accessToken,
48
+ resolution,
49
+ metadataMap
50
+ )
51
+ promise.resolve(null)
52
+ } catch (e: Exception) {
53
+ Log.e(TAG, "Error starting download: ${e.message}", e)
54
+ promise.reject("DOWNLOAD_START_ERROR", e.message, e)
55
+ }
56
+ }
57
+
26
58
  @ReactMethod
27
59
  fun addDownloadProgressListener(promise: Promise) {
28
60
  try {
@@ -78,23 +110,78 @@ class TPStreamsDownloadModule(private val reactContext: ReactApplicationContext)
78
110
  }
79
111
  }
80
112
 
113
+ override fun onDownloadStarted(downloadItem: DownloadItem) {
114
+ try {
115
+ if (isListening) {
116
+ emitEvent("onDownloadStarted", createDownloadStateEventMap(downloadItem))
117
+ }
118
+ } catch (e: Exception) {
119
+ Log.e(TAG, "Error in onDownloadStarted: ${e.message}", e)
120
+ }
121
+ }
122
+
123
+ override fun onDownloadResumed(downloadItem: DownloadItem) {
124
+ try {
125
+ if (isListening) {
126
+ emitEvent("onDownloadResumed", createDownloadStateEventMap(downloadItem))
127
+ }
128
+ } catch (e: Exception) {
129
+ Log.e(TAG, "Error in onDownloadResumed: ${e.message}", e)
130
+ }
131
+ }
132
+
133
+ override fun onDownloadCompleted(downloadItem: DownloadItem) {
134
+ try {
135
+ if (isListening) {
136
+ emitEvent("onDownloadCompleted", createDownloadStateEventMap(downloadItem))
137
+ }
138
+ } catch (e: Exception) {
139
+ Log.e(TAG, "Error in onDownloadCompleted: ${e.message}", e)
140
+ }
141
+ }
142
+
143
+ override fun onDownloadFailed(downloadItem: DownloadItem, error: Exception) {
144
+ try {
145
+ if (isListening) {
146
+ emitEvent("onDownloadFailed", createDownloadStateEventMap(downloadItem, error))
147
+ }
148
+ } catch (e: Exception) {
149
+ Log.e(TAG, "Error in onDownloadFailed: ${e.message}", e)
150
+ }
151
+ }
152
+
153
+ override fun onDownloadDeleted(assetId: String) {
154
+ try {
155
+ if (isListening) {
156
+ val map = Arguments.createMap()
157
+ map.putString("videoId", assetId)
158
+ emitEvent("onDownloadDeleted", map)
159
+ }
160
+ } catch (e: Exception) {
161
+ Log.e(TAG, "Error in onDownloadDeleted: ${e.message}", e)
162
+ }
163
+ }
164
+
165
+ private fun createDownloadStateEventMap(downloadItem: DownloadItem, error: Exception? = null): WritableMap {
166
+ val map = Arguments.createMap()
167
+ map.putMap("downloadItem", createDownloadItemMap(downloadItem))
168
+
169
+ if (error != null) {
170
+ val errorMap = Arguments.createMap()
171
+ errorMap.putString("message", error.message ?: "Unknown error")
172
+ errorMap.putString("type", error.javaClass.simpleName)
173
+ map.putMap("error", errorMap)
174
+ } else {
175
+ map.putNull("error")
176
+ }
177
+ return map
178
+ }
179
+
81
180
  override fun onDownloadStateChanged(downloadItem: DownloadItem, error: Exception?) {
82
- try {
83
- val map = Arguments.createMap()
84
- val downloadItemMap = createDownloadItemMap(downloadItem)
85
- map.putMap("downloadItem", downloadItemMap)
86
-
87
- if (error != null) {
88
- val errorMap = Arguments.createMap()
89
- errorMap.putString("message", error.message ?: "Unknown error")
90
- errorMap.putString("type", error.javaClass.simpleName)
91
- map.putMap("error", errorMap)
92
- } else {
93
- map.putNull("error")
181
+ try {
182
+ if (isListening) {
183
+ emitEvent("onDownloadStateChanged", createDownloadStateEventMap(downloadItem, error))
94
184
  }
95
-
96
- emitEvent("onDownloadStateChanged", map)
97
-
98
185
  } catch (e: Exception) {
99
186
  Log.e(TAG, "Error in onDownloadStateChanged: ${e.message}", e)
100
187
  }
@@ -96,20 +96,7 @@ class TPStreamsRNPlayerViewManager : SimpleViewManager<TPStreamsRNPlayerView>(),
96
96
 
97
97
  @ReactProp(name = "downloadMetadata")
98
98
  override fun setDownloadMetadata(view: TPStreamsRNPlayerView, metadata: String?) {
99
- val metadataMap = if (!metadata.isNullOrEmpty()) {
100
- try {
101
- val jsonObject = org.json.JSONObject(metadata)
102
- val map = jsonObject.keys()
103
- .asSequence()
104
- .associate { it to jsonObject.getString(it) }
105
- .toMutableMap()
106
- map
107
- } catch (e: org.json.JSONException) {
108
- android.util.Log.w("TPStreamsRN", "Error parsing download metadata: ${e.message}")
109
- null
110
- }
111
- } else null
112
- view.setDownloadMetadata(metadataMap)
99
+ view.setDownloadMetadata(JsonUtils.jsonStringToMap(metadata))
113
100
  }
114
101
 
115
102
  // Command implementations
@@ -11,6 +11,13 @@ RCT_EXTERN_METHOD(removeDownloadProgressListener:(RCTPromiseResolveBlock)resolve
11
11
  rejecter:(RCTPromiseRejectBlock)reject)
12
12
 
13
13
  // Download Control Methods
14
+ RCT_EXTERN_METHOD(startDownload:(NSString *)videoId
15
+ accessToken:(NSString *)accessToken
16
+ resolution:(NSString *)resolution
17
+ metadata:(NSDictionary *)metadata
18
+ resolver:(RCTPromiseResolveBlock)resolve
19
+ rejecter:(RCTPromiseRejectBlock)reject)
20
+
14
21
  RCT_EXTERN_METHOD(pauseDownload:(NSString *)videoId
15
22
  resolver:(RCTPromiseResolveBlock)resolve
16
23
  rejecter:(RCTPromiseRejectBlock)reject)
@@ -49,6 +49,20 @@ class TPStreamsDownloadModule: RCTEventEmitter, TPStreamsDownloadDelegate {
49
49
  return true
50
50
  }
51
51
 
52
+ @objc
53
+ func startDownload(_ videoId: String, accessToken: String, resolution: String?, metadata: NSDictionary?, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
54
+ DispatchQueue.main.async { [weak self] in
55
+ guard let self = self else { return }
56
+
57
+ let metadataDict = metadata as? [String: Any]
58
+ let res = (resolution?.isEmpty ?? true) ? nil : resolution
59
+ let presentingVC = (res == nil) ? RCTPresentedViewController() : nil
60
+
61
+ self.downloadManager.startDownload(assetID: videoId, accessToken: accessToken, resolution: res, allowResolutionFallback: true, metadata: metadataDict, presentingViewController: presentingVC, completion: nil)
62
+ resolve(nil)
63
+ }
64
+ }
65
+
52
66
  @objc
53
67
  func addDownloadProgressListener(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
54
68
  isListening = true
@@ -76,74 +90,58 @@ class TPStreamsDownloadModule: RCTEventEmitter, TPStreamsDownloadDelegate {
76
90
 
77
91
  func onDelete(assetId: String) {
78
92
  if isListening {
79
- if let offlineAsset = getOfflineAsset(assetId: assetId) {
80
- notifyDownloadStateChanged(offlineAsset: offlineAsset)
81
- }
82
- notifyDownloadsChange()
93
+ emitDeletedEvent(assetId: assetId)
94
+ }
95
+ }
96
+
97
+ func onFailed(offlineAsset: OfflineAsset, error: Error?) {
98
+ if isListening {
99
+ notifyDownloadLifecycleEvent(name: "onDownloadFailed", asset: offlineAsset, error: error)
83
100
  }
84
101
  }
85
102
 
86
103
  func onStart(offlineAsset: OfflineAsset) {
87
104
  if isListening {
88
- notifyDownloadStateChanged(offlineAsset: offlineAsset)
89
- notifyDownloadsChange()
105
+ notifyDownloadLifecycleEvent(name: "onDownloadStarted", asset: offlineAsset)
90
106
  }
91
107
  }
92
108
 
93
109
  func onComplete(offlineAsset: OfflineAsset) {
94
110
  if isListening {
95
- notifyDownloadStateChanged(offlineAsset: offlineAsset)
96
- notifyDownloadsChange()
111
+ notifyDownloadLifecycleEvent(name: "onDownloadCompleted", asset: offlineAsset)
97
112
  }
98
113
  }
99
114
 
100
115
  func onPause(offlineAsset: OfflineAsset) {
101
116
  if isListening {
102
- notifyDownloadStateChanged(offlineAsset: offlineAsset)
103
- notifyDownloadsChange()
117
+ notifyDownloadLifecycleEvent(name: "onDownloadPaused", asset: offlineAsset)
104
118
  }
105
119
  }
106
120
 
107
121
  func onResume(offlineAsset: OfflineAsset) {
108
122
  if isListening {
109
- notifyDownloadStateChanged(offlineAsset: offlineAsset)
110
- notifyDownloadsChange()
123
+ notifyDownloadLifecycleEvent(name: "onDownloadResumed", asset: offlineAsset)
111
124
  }
112
125
  }
113
126
 
114
127
  func onCanceled(assetId: String) {
115
128
  if isListening {
116
- if let offlineAsset = getOfflineAsset(assetId: assetId) {
117
- notifyDownloadStateChanged(offlineAsset: offlineAsset)
118
- }
119
- notifyDownloadsChange()
129
+ emitDeletedEvent(assetId: assetId)
120
130
  }
121
131
  }
122
132
 
123
- func onRequestNewAccessToken(assetId: String, completion: @escaping (String?) -> Void) {
124
- if let delegate = tokenDelegate {
125
- delegate.requestToken(for: assetId, completion: completion)
126
- } else {
127
- completion(nil)
128
- }
129
- }
130
-
131
- private func notifyDownloadsChange() {
132
- DispatchQueue.main.async { [weak self] in
133
- guard let self = self else { return }
134
- let downloadAssets = self.getAllDownloadItems()
135
- self.sendEvent(withName: "onDownloadProgressChanged", body: downloadAssets)
136
- }
133
+ private func notifyDownloadLifecycleEvent(name: String, asset: OfflineAsset, error: Error? = nil) {
134
+ emitSingleDownloadEvent(name: name, asset: asset, error: error)
135
+ emitSingleDownloadEvent(name: "onDownloadStateChanged", asset: asset, error: error)
136
+ notifyDownloadsChange()
137
137
  }
138
-
139
- private func notifyDownloadStateChanged(offlineAsset: OfflineAsset, error: Error? = nil) {
138
+
139
+ private func emitSingleDownloadEvent(name: String, asset: OfflineAsset, error: Error? = nil) {
140
140
  DispatchQueue.main.async { [weak self] in
141
141
  guard let self = self else { return }
142
142
 
143
- let downloadItem = self.mapOfflineAssetToDict(offlineAsset)
144
-
145
- var eventData: [String: Any] = [:]
146
- eventData["downloadItem"] = downloadItem
143
+ let downloadItem = self.mapOfflineAssetToDict(asset)
144
+ var eventData: [String: Any] = ["downloadItem": downloadItem]
147
145
 
148
146
  if let error = error {
149
147
  eventData["error"] = [
@@ -154,7 +152,29 @@ class TPStreamsDownloadModule: RCTEventEmitter, TPStreamsDownloadDelegate {
154
152
  eventData["error"] = NSNull()
155
153
  }
156
154
 
157
- self.sendEvent(withName: "onDownloadStateChanged", body: eventData)
155
+ self.sendEvent(withName: name, body: eventData)
156
+ }
157
+ }
158
+
159
+ private func emitDeletedEvent(assetId: String) {
160
+ let eventData: [String: Any] = ["videoId": assetId]
161
+ self.sendEvent(withName: "onDownloadDeleted", body: eventData)
162
+ notifyDownloadsChange()
163
+ }
164
+
165
+ func onRequestNewAccessToken(assetId: String, completion: @escaping (String?) -> Void) {
166
+ if let delegate = tokenDelegate {
167
+ delegate.requestToken(for: assetId, completion: completion)
168
+ } else {
169
+ completion(nil)
170
+ }
171
+ }
172
+
173
+ private func notifyDownloadsChange() {
174
+ DispatchQueue.main.async { [weak self] in
175
+ guard let self = self else { return }
176
+ let downloadAssets = self.getAllDownloadItems()
177
+ self.sendEvent(withName: "onDownloadProgressChanged", body: downloadAssets)
158
178
  }
159
179
  }
160
180
 
@@ -314,7 +334,16 @@ class TPStreamsDownloadModule: RCTEventEmitter, TPStreamsDownloadDelegate {
314
334
 
315
335
  @objc
316
336
  override func supportedEvents() -> [String] {
317
- return ["onDownloadProgressChanged", "onDownloadStateChanged"]
337
+ return [
338
+ "onDownloadProgressChanged",
339
+ "onDownloadStateChanged",
340
+ "onDownloadStarted",
341
+ "onDownloadPaused",
342
+ "onDownloadResumed",
343
+ "onDownloadCompleted",
344
+ "onDownloadFailed",
345
+ "onDownloadDeleted"
346
+ ]
318
347
  }
319
348
 
320
349
  @objc
@@ -5,6 +5,9 @@ const {
5
5
  TPStreamsDownload
6
6
  } = NativeModules;
7
7
  const downloadEventEmitter = new NativeEventEmitter(TPStreamsDownload);
8
+ export function startDownload(videoId, accessToken, resolution = null, metadata = null) {
9
+ return TPStreamsDownload.startDownload(videoId, accessToken, resolution, metadata);
10
+ }
8
11
  export function addDownloadProgressListener() {
9
12
  return TPStreamsDownload.addDownloadProgressListener();
10
13
  }
@@ -14,10 +17,21 @@ export function removeDownloadProgressListener() {
14
17
  export function onDownloadProgressChanged(listener) {
15
18
  return downloadEventEmitter.addListener('onDownloadProgressChanged', listener);
16
19
  }
17
- export function onDownloadStateChanged(listener) {
18
- return downloadEventEmitter.addListener('onDownloadStateChanged', event => {
20
+ const createDownloadStateListener = eventName => listener => {
21
+ return downloadEventEmitter.addListener(eventName, event => {
19
22
  listener(event.downloadItem, event.error);
20
23
  });
24
+ };
25
+ export const onDownloadStateChanged = createDownloadStateListener('onDownloadStateChanged');
26
+ export const onDownloadStarted = createDownloadStateListener('onDownloadStarted');
27
+ export const onDownloadPaused = createDownloadStateListener('onDownloadPaused');
28
+ export const onDownloadResumed = createDownloadStateListener('onDownloadResumed');
29
+ export const onDownloadCompleted = createDownloadStateListener('onDownloadCompleted');
30
+ export const onDownloadFailed = createDownloadStateListener('onDownloadFailed');
31
+ export function onDownloadDeleted(listener) {
32
+ return downloadEventEmitter.addListener('onDownloadDeleted', event => {
33
+ listener(event.videoId);
34
+ });
21
35
  }
22
36
  export function pauseDownload(videoId) {
23
37
  return TPStreamsDownload.pauseDownload(videoId);
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","NativeEventEmitter","TPStreamsDownload","downloadEventEmitter","addDownloadProgressListener","removeDownloadProgressListener","onDownloadProgressChanged","listener","addListener","onDownloadStateChanged","event","downloadItem","error","pauseDownload","videoId","resumeDownload","removeDownload","isDownloaded","isDownloading","isPaused","getDownloadStatus","getAllDownloads"],"sourceRoot":"../../src","sources":["TPStreamsDownload.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,cAAc;AAGhE,MAAM;EAAEC;AAAkB,CAAC,GAAGF,aAAa;AA4B3C,MAAMG,oBAAoB,GAAG,IAAIF,kBAAkB,CAACC,iBAAiB,CAAC;AAEtE,OAAO,SAASE,2BAA2BA,CAAA,EAAkB;EAC3D,OAAOF,iBAAiB,CAACE,2BAA2B,CAAC,CAAC;AACxD;AAEA,OAAO,SAASC,8BAA8BA,CAAA,EAAkB;EAC9D,OAAOH,iBAAiB,CAACG,8BAA8B,CAAC,CAAC;AAC3D;AAEA,OAAO,SAASC,yBAAyBA,CACvCC,QAAkC,EACb;EACrB,OAAOJ,oBAAoB,CAACK,WAAW,CACrC,2BAA2B,EAC3BD,QACF,CAAC;AACH;AAEA,OAAO,SAASE,sBAAsBA,CACpCF,QAAqC,EAChB;EACrB,OAAOJ,oBAAoB,CAACK,WAAW,CAAC,wBAAwB,EAAGE,KAAK,IAAK;IAC3EH,QAAQ,CAACG,KAAK,CAACC,YAAY,EAAED,KAAK,CAACE,KAAK,CAAC;EAC3C,CAAC,CAAC;AACJ;AAEA,OAAO,SAASC,aAAaA,CAACC,OAAe,EAAiB;EAC5D,OAAOZ,iBAAiB,CAACW,aAAa,CAACC,OAAO,CAAC;AACjD;AAEA,OAAO,SAASC,cAAcA,CAACD,OAAe,EAAiB;EAC7D,OAAOZ,iBAAiB,CAACa,cAAc,CAACD,OAAO,CAAC;AAClD;AAEA,OAAO,SAASE,cAAcA,CAACF,OAAe,EAAiB;EAC7D,OAAOZ,iBAAiB,CAACc,cAAc,CAACF,OAAO,CAAC;AAClD;AAEA,OAAO,SAASG,YAAYA,CAACH,OAAe,EAAoB;EAC9D,OAAOZ,iBAAiB,CAACe,YAAY,CAACH,OAAO,CAAC;AAChD;AAEA,OAAO,SAASI,aAAaA,CAACJ,OAAe,EAAoB;EAC/D,OAAOZ,iBAAiB,CAACgB,aAAa,CAACJ,OAAO,CAAC;AACjD;AAEA,OAAO,SAASK,QAAQA,CAACL,OAAe,EAAoB;EAC1D,OAAOZ,iBAAiB,CAACiB,QAAQ,CAACL,OAAO,CAAC;AAC5C;AAEA,OAAO,SAASM,iBAAiBA,CAACN,OAAe,EAAmB;EAClE,OAAOZ,iBAAiB,CAACkB,iBAAiB,CAACN,OAAO,CAAC;AACrD;AAEA,OAAO,SAASO,eAAeA,CAAA,EAA4B;EACzD,OAAOnB,iBAAiB,CAACmB,eAAe,CAAC,CAAC;AAC5C","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","NativeEventEmitter","TPStreamsDownload","downloadEventEmitter","startDownload","videoId","accessToken","resolution","metadata","addDownloadProgressListener","removeDownloadProgressListener","onDownloadProgressChanged","listener","addListener","createDownloadStateListener","eventName","event","downloadItem","error","onDownloadStateChanged","onDownloadStarted","onDownloadPaused","onDownloadResumed","onDownloadCompleted","onDownloadFailed","onDownloadDeleted","pauseDownload","resumeDownload","removeDownload","isDownloaded","isDownloading","isPaused","getDownloadStatus","getAllDownloads"],"sourceRoot":"../../src","sources":["TPStreamsDownload.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,cAAc;AAGhE,MAAM;EAAEC;AAAkB,CAAC,GAAGF,aAAa;AA4B3C,MAAMG,oBAAoB,GAAG,IAAIF,kBAAkB,CAACC,iBAAiB,CAAC;AAEtE,OAAO,SAASE,aAAaA,CAC3BC,OAAe,EACfC,WAAmB,EACnBC,UAAyB,GAAG,IAAI,EAChCC,QAAoC,GAAG,IAAI,EAC5B;E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,OAAe,EAAiB;EAC5D,OAAOH,iBAAiB,CAACwB,aAAa,CAACrB,OAAO,CAAC;AACjD;AAEA,OAAO,SAASsB,cAAcA,CAACtB,OAAe,EAAiB;EAC7D,OAAOH,iBAAiB,CAACyB,cAAc,CAACtB,OAAO,CAAC;AAClD;AAEA,OAAO,SAASuB,cAAcA,CAACvB,OAAe,EAAiB;EAC7D,OAAOH,iBAAiB,CAAC0B,cAAc,CAACvB,OAAO,CAAC;AAClD;AAEA,OAAO,SAASwB,YAAYA,CAACxB,OAAe,EAAoB;EAC9D,OAAOH,iBAAiB,CAAC2B,YAAY,CAACxB,OAAO,CAAC;AAChD;AAEA,OAAO,SAASyB,aAAaA,CAACzB,OAAe,EAAoB;EAC/D,OAAOH,iBAAiB,CAAC4B,aAAa,CAACzB,OAAO,CAAC;AACjD;AAEA,OAAO,SAAS0B,QAAQA,CAAC1B,OAAe,EAAoB;EAC1D,OAAOH,iBAAiB,CAAC6B,QAAQ,CAAC1B,OAAO,CAAC;AAC5C;AAEA,OAAO,SAAS2B,iBAAiBA,CAAC3B,OAAe,EAAmB;EAClE,OAAOH,iBAAiB,CAAC8B,iBAAiB,CAAC3B,OAAO,CAAC;AACrD;AAEA,OAAO,SAAS4B,eAAeA,CAAA,EAA4B;EACzD,OAAO/B,iBAAiB,CAAC+B,eAAe,CAAC,CAAC;AAC5C","ignoreList":[]}
@@ -7,7 +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, addDownloadProgressListener, removeDownloadProgressListener, onDownloadProgressChanged, onDownloadStateChanged } from "./TPStreamsDownload.js";
10
+ export { startDownload, pauseDownload, resumeDownload, removeDownload, isDownloaded, isDownloading, isPaused, getDownloadStatus, getAllDownloads, addDownloadProgressListener, removeDownloadProgressListener, onDownloadProgressChanged, onDownloadStateChanged, onDownloadStarted, onDownloadPaused, onDownloadResumed, onDownloadCompleted, onDownloadFailed, onDownloadDeleted } from "./TPStreamsDownload.js";
11
11
  const TPStreamsModule = NativeModules.TPStreams;
12
12
  export const TPStreams = {
13
13
  initialize: organizationId => {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","default","TPStreamsPlayerNative","TPStreamsPlayerView","pauseDownload","resumeDownload","removeDownload","isDownloaded","isDownloading","isPaused","getDownloadStatus","getAllDownloads","addDownloadProgressListener","removeDownloadProgressListener","onDownloadProgressChanged","onDownloadStateChanged","TPStreamsModule","TPStreams","initialize","organizationId","TPStreamsLiveChat"],"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,EACfC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,yBAAyB,EACzBC,sBAAsB,QAKjB,wBAAqB;AAE5B,MAAMC,eAAe,GAAGhB,aAAa,CAACiB,SAAS;AAE/C,OAAO,MAAMA,SAAS,GAAG;EACvBC,UAAU,EAAGC,cAAsB,IAAW;IAC5CH,eAAe,CAACE,UAAU,CAACC,cAAc,CAAC;EAC5C;AACF,CAAC;AAED,SAASlB,OAAO,IAAImB,iBAAiB,QAAQ,wBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","default","TPStreamsPlayerNative","TPStreamsPlayerView","startDownload","pauseDownload","resumeDownload","removeDownload","isDownloaded","isDownloading","isPaused","getDownloadStatus","getAllDownloads","addDownloadProgressListener","removeDownloadProgressListener","onDownloadProgressChanged","onDownloadStateChanged","onDownloadStarted","onDownloadPaused","onDownloadResumed","onDownloadCompleted","onDownloadFailed","onDownloadDeleted","TPStreamsModule","TPStreams","initialize","organizationId","TPStreamsLiveChat"],"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,aAAa,EACbC,cAAc,EACdC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,yBAAyB,EACzBC,sBAAsB,EACtBC,iBAAiB,EACjBC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,gBAAgB,EAChBC,iBAAiB,QAKZ,wBAAqB;AAE5B,MAAMC,eAAe,GAAGvB,aAAa,CAACwB,SAAS;AAE/C,OAAO,MAAMA,SAAS,GAAG;EACvBC,UAAU,EAAGC,cAAsB,IAAW;IAC5CH,eAAe,CAACE,UAAU,CAACC,cAAc,CAAC;EAC5C;AACF,CAAC;AAED,SAASzB,OAAO,IAAI0B,iBAAiB,QAAQ,wBAAqB","ignoreList":[]}
@@ -16,10 +16,17 @@ export interface DownloadError {
16
16
  type: string;
17
17
  }
18
18
  export type DownloadStateChangeListener = (downloadItem: DownloadItem, error: DownloadError | null) => void;
19
+ export declare function startDownload(videoId: string, accessToken: string, resolution?: string | null, metadata?: Record<string, any> | null): Promise<void>;
19
20
  export declare function addDownloadProgressListener(): Promise<void>;
20
21
  export declare function removeDownloadProgressListener(): Promise<void>;
21
22
  export declare function onDownloadProgressChanged(listener: DownloadProgressListener): EmitterSubscription;
22
- export declare function onDownloadStateChanged(listener: DownloadStateChangeListener): EmitterSubscription;
23
+ export declare const onDownloadStateChanged: (listener: DownloadStateChangeListener) => EmitterSubscription;
24
+ export declare const onDownloadStarted: (listener: DownloadStateChangeListener) => EmitterSubscription;
25
+ export declare const onDownloadPaused: (listener: DownloadStateChangeListener) => EmitterSubscription;
26
+ export declare const onDownloadResumed: (listener: DownloadStateChangeListener) => EmitterSubscription;
27
+ export declare const onDownloadCompleted: (listener: DownloadStateChangeListener) => EmitterSubscription;
28
+ export declare const onDownloadFailed: (listener: DownloadStateChangeListener) => EmitterSubscription;
29
+ export declare function onDownloadDeleted(listener: (videoId: string) => void): EmitterSubscription;
23
30
  export declare function pauseDownload(videoId: string): Promise<void>;
24
31
  export declare function resumeDownload(videoId: string): Promise<void>;
25
32
  export declare function removeDownload(videoId: string): Promise<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,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC;AAClD,MAAM,MAAM,wBAAwB,GAAG,CACrC,SAAS,EAAE,sBAAsB,EAAE,KAChC,IAAI,CAAC;AAEV,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,2BAA2B,GAAG,CACxC,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,aAAa,GAAG,IAAI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C;AAEhF,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAClC,mBAAmB,CAIrB;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"}
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  /// <reference types="react-native/types/modules/Codegen" />
3
+ /// <reference types="react-native/types/modules/Codegen" />
3
4
  import type { ViewProps } from 'react-native';
4
5
  import type { Double, Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
5
6
  import type { HostComponent } from 'react-native';
@@ -1 +1 @@
1
- {"version":3,"file":"TPStreamsPlayerViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/TPStreamsPlayerViewNativeComponent.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,MAAM,EACN,KAAK,EACL,KAAK,EACN,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAA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AO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;IAC7E,SAAS,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;IAC3E,gBAAgB,EAAE,CAChB,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAClD,IAAI,CAAC;IACV,iBAAiB,EAAE,CACjB,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,EACrD,QAAQ,EAAE,MAAM,KACb,IAAI,CAAC;CACX;AAED,eAAO,MAAM,QAAQ,6BAYnB,CAAC;;AAEH,wBAA4E"}
@@ -2,7 +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, addDownloadProgressListener, removeDownloadProgressListener, onDownloadProgressChanged, onDownloadStateChanged, type DownloadItem, type DownloadProgressChange, type DownloadProgressListener, type DownloadStateChangeListener, } from './TPStreamsDownload';
5
+ export { startDownload, pauseDownload, resumeDownload, removeDownload, isDownloaded, isDownloading, isPaused, getDownloadStatus, getAllDownloads, addDownloadProgressListener, removeDownloadProgressListener, onDownloadProgressChanged, onDownloadStateChanged, onDownloadStarted, onDownloadPaused, onDownloadResumed, onDownloadCompleted, onDownloadFailed, onDownloadDeleted, type DownloadItem, type DownloadProgressChange, type DownloadProgressListener, type DownloadStateChangeListener, } from './TPStreamsDownload';
6
6
  export declare const TPStreams: {
7
7
  initialize: (organizationId: string) => void;
8
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;AAE5D,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,8BAA8B,EAC9B,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,GACjC,MAAM,qBAAqB,CAAC;AAI7B,eAAO,MAAM,SAAS;iCACS,MAAM,KAAG,IAAI;CAG3C,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EACV,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,WAAW,GACZ,MAAM,gCAAgC,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,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,8BAA8B,EAC9B,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,GACjC,MAAM,qBAAqB,CAAC;AAI7B,eAAO,MAAM,SAAS;iCACS,MAAM,KAAG,IAAI;CAG3C,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EACV,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,WAAW,GACZ,MAAM,gCAAgC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tpstreams",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "Video component for TPStreams",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -31,6 +31,20 @@ export type DownloadStateChangeListener = (
31
31
 
32
32
  const downloadEventEmitter = new NativeEventEmitter(TPStreamsDownload);
33
33
 
34
+ export function startDownload(
35
+ videoId: string,
36
+ accessToken: string,
37
+ resolution: string | null = null,
38
+ metadata: Record<string, any> | null = null
39
+ ): Promise<void> {
40
+ return TPStreamsDownload.startDownload(
41
+ videoId,
42
+ accessToken,
43
+ resolution,
44
+ metadata
45
+ );
46
+ }
47
+
34
48
  export function addDownloadProgressListener(): Promise<void> {
35
49
  return TPStreamsDownload.addDownloadProgressListener();
36
50
  }
@@ -48,11 +62,32 @@ export function onDownloadProgressChanged(
48
62
  );
49
63
  }
50
64
 
51
- export function onDownloadStateChanged(
52
- listener: DownloadStateChangeListener
65
+ const createDownloadStateListener =
66
+ (eventName: string) =>
67
+ (listener: DownloadStateChangeListener): EmitterSubscription => {
68
+ return downloadEventEmitter.addListener(eventName, (event) => {
69
+ listener(event.downloadItem, event.error);
70
+ });
71
+ };
72
+
73
+ export const onDownloadStateChanged = createDownloadStateListener(
74
+ 'onDownloadStateChanged'
75
+ );
76
+ export const onDownloadStarted =
77
+ createDownloadStateListener('onDownloadStarted');
78
+ export const onDownloadPaused = createDownloadStateListener('onDownloadPaused');
79
+ export const onDownloadResumed =
80
+ createDownloadStateListener('onDownloadResumed');
81
+ export const onDownloadCompleted = createDownloadStateListener(
82
+ 'onDownloadCompleted'
83
+ );
84
+ export const onDownloadFailed = createDownloadStateListener('onDownloadFailed');
85
+
86
+ export function onDownloadDeleted(
87
+ listener: (videoId: string) => void
53
88
  ): EmitterSubscription {
54
- return downloadEventEmitter.addListener('onDownloadStateChanged', (event) => {
55
- listener(event.downloadItem, event.error);
89
+ return downloadEventEmitter.addListener('onDownloadDeleted', (event) => {
90
+ listener(event.videoId);
56
91
  });
57
92
  }
58
93
 
package/src/index.tsx CHANGED
@@ -8,6 +8,7 @@ export { default as TPStreamsPlayerView } from './TPStreamsPlayer';
8
8
  export type { TPStreamsPlayerRef } from './TPStreamsPlayer';
9
9
 
10
10
  export {
11
+ startDownload,
11
12
  pauseDownload,
12
13
  resumeDownload,
13
14
  removeDownload,
@@ -20,6 +21,12 @@ export {
20
21
  removeDownloadProgressListener,
21
22
  onDownloadProgressChanged,
22
23
  onDownloadStateChanged,
24
+ onDownloadStarted,
25
+ onDownloadPaused,
26
+ onDownloadResumed,
27
+ onDownloadCompleted,
28
+ onDownloadFailed,
29
+ onDownloadDeleted,
23
30
  type DownloadItem,
24
31
  type DownloadProgressChange,
25
32
  type DownloadProgressListener,