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.
Files changed (45) hide show
  1. package/README.md +135 -3
  2. package/{Tpstreams.podspec → TPStreamsRNPlayerView.podspec} +7 -2
  3. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerDelegate.java +78 -0
  4. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerInterface.java +31 -0
  5. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
  6. package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec-generated.cpp +22 -0
  7. package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec.h +24 -0
  8. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.cpp +22 -0
  9. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h +24 -0
  10. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.cpp +98 -0
  11. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h +75 -0
  12. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.cpp +30 -0
  13. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.h +32 -0
  14. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.cpp +17 -0
  15. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h +32 -0
  16. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.cpp +16 -0
  17. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.h +29 -0
  18. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI-generated.cpp +17 -0
  19. package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI.h +19 -0
  20. package/android/build.gradle +1 -1
  21. package/android/src/main/java/com/tpstreams/TPStreamsDownloadModule.kt +128 -0
  22. package/android/src/main/java/com/tpstreams/TPStreamsRNPackage.kt +1 -0
  23. package/android/src/main/java/com/tpstreams/TPStreamsRNPlayerView.kt +4 -0
  24. package/android/src/main/java/com/tpstreams/TPStreamsRNPlayerViewManager.kt +5 -0
  25. package/ios/TPStreamsDownloadModule.mm +7 -0
  26. package/ios/TPStreamsDownloadModule.swift +13 -0
  27. package/ios/TPStreamsModule.mm +7 -0
  28. package/ios/TPStreamsModule.swift +17 -0
  29. package/ios/TPStreamsRNPlayerView.h +14 -0
  30. package/ios/TPStreamsRNPlayerView.mm +52 -0
  31. package/ios/TPStreamsRNPlayerViewManager.mm +18 -0
  32. package/lib/module/TPStreamsDownload.js +31 -0
  33. package/lib/module/TPStreamsDownload.js.map +1 -0
  34. package/lib/module/index.js +1 -0
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/typescript/src/TPStreamsDownload.d.ts +18 -0
  37. package/lib/typescript/src/TPStreamsDownload.d.ts.map +1 -0
  38. package/lib/typescript/src/index.d.ts +1 -0
  39. package/lib/typescript/src/index.d.ts.map +1 -1
  40. package/package.json +2 -2
  41. package/src/TPStreamsDownload.tsx +45 -0
  42. package/src/index.tsx +12 -0
  43. package/ios/TpstreamsView.h +0 -14
  44. package/ios/TpstreamsView.mm +0 -71
  45. package/ios/TpstreamsViewManager.mm +0 -19
package/README.md CHANGED
@@ -89,6 +89,40 @@ import { TPStreamsPlayerView } from "react-native-tpstreams";
89
89
 
90
90
  - `showDefaultCaptions`: (Optional) Whether to show default captions if available. Default is false.
91
91
 
92
+ - `enableDownload`: (Optional) Whether to enable download functionality for the video. When set to true, the player will show a download button. Default is false.
93
+
94
+ ---
95
+
96
+ ## Downloads
97
+
98
+ ### Download Methods
99
+
100
+ - `pauseDownload(videoId: string)`: Pauses an ongoing download. Returns `Promise<void>`.
101
+
102
+ - `resumeDownload(videoId: string)`: Resumes a paused download. Returns `Promise<void>`.
103
+
104
+ - `removeDownload(videoId: string)`: Removes a downloaded video. Returns `Promise<void>`.
105
+
106
+ - `isDownloaded(videoId: string)`: Checks if a video has been downloaded. Returns `Promise<boolean>`.
107
+
108
+ - `isDownloading(videoId: string)`: Checks if a video is currently downloading. Returns `Promise<boolean>`.
109
+
110
+ - `isPaused(videoId: string)`: Checks if a video download is paused. Returns `Promise<boolean>`.
111
+
112
+ - `getDownloadStatus(videoId: string)`: Gets the download status of a video as a descriptive string. Returns `Promise<string>`.
113
+
114
+ - `getAllDownloads()`: Gets all downloaded videos. Returns `Promise<DownloadItem[]>`.
115
+
116
+ ### Download Item
117
+
118
+ The download item object (`DownloadItem`) contains information about a downloaded or downloading video, including:
119
+
120
+ - `assetId`: The ID of the video.
121
+ - `state`: The current state of the download as String (Queued, Downloading, Completed, Failed, Removing, Restarting, Paused ).
122
+ - `progressPercentage`: Download progress from 0 to 100.
123
+ - `title`: The title of the video Asset.
124
+ - `thumbnailUrl`: URL to the video thumbnail (if available).
125
+
92
126
  ---
93
127
 
94
128
  ## Example
@@ -133,6 +167,7 @@ function TPStreamsPlayerExample() {
133
167
  startAt={100}
134
168
  shouldAutoPlay={false}
135
169
  showDefaultCaptions={true}
170
+ enableDownload={true}
136
171
  onPlayerStateChanged={(state) => console.log(`Player state: ${state}`)}
137
172
  onIsPlayingChanged={(isPlaying) => console.log(`Is playing: ${isPlaying}`)}
138
173
  onPlaybackSpeedChanged={(speed) => console.log(`Speed changed: ${speed}x`)}
@@ -152,12 +187,109 @@ function TPStreamsPlayerExample() {
152
187
 
153
188
  ---
154
189
 
190
+ ## Download Example
191
+
192
+ ```js
193
+ import {
194
+ pauseDownload,
195
+ resumeDownload,
196
+ removeDownload,
197
+ getAllDownloads,
198
+ getDownloadStatus,
199
+ isDownloaded,
200
+ isDownloading,
201
+ type DownloadItem,
202
+ } from 'react-native-tpstreams';
203
+
204
+ // Get all downloads
205
+ const loadDownloads = async () => {
206
+ try {
207
+ const items: DownloadItem[] = await getAllDownloads();
208
+ console.log(`Found ${items.length} downloads`);
209
+ return items;
210
+ } catch (error) {
211
+ console.error('Failed to load downloads:', error);
212
+ }
213
+ };
214
+
215
+ // Check download status
216
+ const checkStatus = async (videoId: string) => {
217
+ try {
218
+ const status = await getDownloadStatus(videoId);
219
+ console.log(`Status: ${status}`);
220
+ return status;
221
+ } catch (error) {
222
+ console.error('Error checking status:', error);
223
+ }
224
+ };
225
+
226
+ // Check if video is downloaded
227
+ const checkIfDownloaded = async (videoId: string) => {
228
+ try {
229
+ const downloaded: boolean = await isDownloaded(videoId);
230
+ console.log(`Is downloaded: ${downloaded}`);
231
+ return downloaded;
232
+ } catch (error) {
233
+ console.error('Error checking if downloaded:', error);
234
+ }
235
+ };
236
+
237
+ // Check if video is currently downloading
238
+ const checkIfDownloading = async (videoId: string) => {
239
+ try {
240
+ const downloading: boolean = await isDownloading(videoId);
241
+ console.log(`Is downloading: ${downloading}`);
242
+ return downloading;
243
+ } catch (error) {
244
+ console.error('Error checking if downloading:', error);
245
+ }
246
+ };
247
+
248
+ // Pause a download
249
+ const pauseVideoDownload = async (videoId: string) => {
250
+ try {
251
+ await pauseDownload(videoId);
252
+ console.log('Download paused successfully');
253
+
254
+ // Check status after pausing
255
+ const status = await getDownloadStatus(videoId);
256
+ console.log(`New status: ${status}`);
257
+ } catch (error) {
258
+ console.error('Error pausing download:', error);
259
+ }
260
+ };
261
+
262
+ // Resume a download
263
+ const resumeVideoDownload = async (videoId: string) => {
264
+ try {
265
+ await resumeDownload(videoId);
266
+ console.log('Download resumed');
267
+
268
+ // Check status after resuming
269
+ const status = await getDownloadStatus(videoId);
270
+ console.log(`New status: ${status}`);
271
+ } catch (error) {
272
+ console.error('Error resuming download:', error);
273
+ }
274
+ };
275
+
276
+ // Remove a download
277
+ const removeVideoDownload = async (videoId: string) => {
278
+ try {
279
+ await removeDownload(videoId);
280
+ console.log('Download removed');
281
+ } catch (error) {
282
+ console.error('Error removing download:', error);
283
+ }
284
+ };
285
+ ```
286
+
287
+ ---
288
+
155
289
  ## Contributing
156
290
 
157
291
  See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
158
292
 
159
293
  ## License
160
294
 
161
- MIT
162
-
163
- ---
295
+ MIT
@@ -3,7 +3,7 @@ require "json"
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
4
 
5
5
  Pod::Spec.new do |s|
6
- s.name = "Tpstreams"
6
+ s.name = "TPStreamsRNPlayerView"
7
7
  s.version = package["version"]
8
8
  s.summary = package["description"]
9
9
  s.homepage = package["homepage"]
@@ -13,8 +13,13 @@ Pod::Spec.new do |s|
13
13
  s.platforms = { :ios => min_ios_version_supported }
14
14
  s.source = { :git => "https://github.com/testpress/react-native-tpstreams.git", :tag => "#{s.version}" }
15
15
 
16
- s.source_files = "ios/**/*.{h,m,mm,cpp}"
16
+ s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
17
17
  s.private_header_files = "ios/**/*.h"
18
+
19
+ s.swift_version = '5.0'
20
+
21
+ # Ensure the module is not built as a framework to avoid bridging header conflicts
22
+ s.static_framework = true
18
23
 
19
24
  install_modules_dependencies(s)
20
25
  end
@@ -0,0 +1,78 @@
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
+ default:
45
+ super.setProperty(view, propName, value);
46
+ }
47
+ }
48
+
49
+ @Override
50
+ public void receiveCommand(T view, String commandName, @Nullable ReadableArray args) {
51
+ switch (commandName) {
52
+ case "play":
53
+ mViewManager.play(view);
54
+ break;
55
+ case "pause":
56
+ mViewManager.pause(view);
57
+ break;
58
+ case "seekTo":
59
+ mViewManager.seekTo(view, args.getDouble(0));
60
+ break;
61
+ case "setPlaybackSpeed":
62
+ mViewManager.setPlaybackSpeed(view, (float) args.getDouble(0));
63
+ break;
64
+ case "getCurrentPosition":
65
+ mViewManager.getCurrentPosition(view);
66
+ break;
67
+ case "getDuration":
68
+ mViewManager.getDuration(view);
69
+ break;
70
+ case "isPlaying":
71
+ mViewManager.isPlaying(view);
72
+ break;
73
+ case "getPlaybackSpeed":
74
+ mViewManager.getPlaybackSpeed(view);
75
+ break;
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,31 @@
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 play(T view);
24
+ void pause(T view);
25
+ void seekTo(T view, double positionMs);
26
+ void setPlaybackSpeed(T view, float speed);
27
+ void getCurrentPosition(T view);
28
+ void getDuration(T view);
29
+ void isPlaying(T view);
30
+ void getPlaybackSpeed(T view);
31
+ }
@@ -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,98 @@
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
+ } // namespace facebook::react
@@ -0,0 +1,75 @@
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
+ void onCurrentPosition(OnCurrentPosition value) const;
58
+
59
+ void onDuration(OnDuration value) const;
60
+
61
+ void onIsPlaying(OnIsPlaying value) const;
62
+
63
+ void onPlaybackSpeed(OnPlaybackSpeed value) const;
64
+
65
+ void onPlayerStateChanged(OnPlayerStateChanged value) const;
66
+
67
+ void onIsPlayingChanged(OnIsPlayingChanged value) const;
68
+
69
+ void onPlaybackSpeedChanged(OnPlaybackSpeedChanged value) const;
70
+
71
+ void onIsLoadingChanged(OnIsLoadingChanged value) const;
72
+
73
+ void onError(OnError value) const;
74
+ };
75
+ } // namespace facebook::react
@@ -0,0 +1,30 @@
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
+ {}
29
+
30
+ } // 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: 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
+ };
31
+
32
+ } // 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