react-native-tpstreams 0.2.20 → 0.2.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tpstreams",
3
- "version": "0.2.20",
3
+ "version": "0.2.21",
4
4
  "description": "Video component for TPStreams",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -18,6 +18,7 @@
18
18
  "android",
19
19
  "ios",
20
20
  "cpp",
21
+ "spec",
21
22
  "*.podspec",
22
23
  "react-native.config.js",
23
24
  "!ios/build",
@@ -0,0 +1,8 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ initialize(organizationId: string): void;
6
+ }
7
+
8
+ export default TurboModuleRegistry.getEnforcing<Spec>('TPStreams');
@@ -0,0 +1,32 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ export type DownloadItem = {
5
+ videoId: string;
6
+ title: string;
7
+ thumbnailUrl?: string;
8
+ totalBytes: number;
9
+ downloadedBytes: number;
10
+ progressPercentage: number;
11
+ state: string;
12
+ };
13
+
14
+ export interface Spec extends TurboModule {
15
+ // Download management methods
16
+ getAll(): Promise<DownloadItem[]>;
17
+ get(videoId: string): Promise<DownloadItem | null>;
18
+ pause(videoId: string): Promise<void>;
19
+ resume(videoId: string): Promise<void>;
20
+ remove(videoId: string): Promise<void>;
21
+
22
+ // Progress monitoring methods
23
+ startProgressUpdates(): void;
24
+ stopProgressUpdates(): void;
25
+
26
+ // Required by React Native's NativeEventEmitter
27
+ // These are used internally by the event emitter
28
+ addListener(eventName: string): void;
29
+ removeListeners(count: number): void;
30
+ }
31
+
32
+ export default TurboModuleRegistry.getEnforcing<Spec>('TPStreamsDownloads');
@@ -0,0 +1,82 @@
1
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
2
+ import type { ViewProps } from 'react-native';
3
+ import type {
4
+ Double,
5
+ Float,
6
+ Int32,
7
+ } from 'react-native/Libraries/Types/CodegenTypes';
8
+ import type { HostComponent } from 'react-native';
9
+ import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
10
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
11
+
12
+ export interface ErrorEvent {
13
+ message: string;
14
+ code: Int32;
15
+ details?: string;
16
+ }
17
+
18
+ export interface NativeProps extends ViewProps {
19
+ videoId?: string;
20
+ accessToken?: string;
21
+ shouldAutoPlay?: boolean;
22
+ startAt?: Double;
23
+ enableDownload?: boolean;
24
+ offlineLicenseExpireTime?: Double;
25
+ showDefaultCaptions?: boolean;
26
+ downloadMetadata?: string;
27
+
28
+ // Event props for receiving data from native methods
29
+ onCurrentPosition?: DirectEventHandler<{ position: Double }>;
30
+ onDuration?: DirectEventHandler<{ duration: Double }>;
31
+ onIsPlaying?: DirectEventHandler<{ isPlaying: boolean }>;
32
+ onPlaybackSpeed?: DirectEventHandler<{ speed: Float }>;
33
+
34
+ // Player event props
35
+ onPlayerStateChanged?: DirectEventHandler<{ playbackState: Int32 }>;
36
+ onIsPlayingChanged?: DirectEventHandler<{ isPlaying: boolean }>;
37
+ onPlaybackSpeedChanged?: DirectEventHandler<{ speed: Double }>;
38
+ onIsLoadingChanged?: DirectEventHandler<{ isLoading: boolean }>;
39
+ onError?: DirectEventHandler<ErrorEvent>;
40
+ onAccessTokenExpired?: DirectEventHandler<{ videoId: string }>;
41
+ }
42
+
43
+ interface TPStreamsPlayerViewCommands {
44
+ play: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
45
+ pause: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
46
+ seekTo: (
47
+ viewRef: React.ElementRef<HostComponent<NativeProps>>,
48
+ positionMs: Double
49
+ ) => void;
50
+ setPlaybackSpeed: (
51
+ viewRef: React.ElementRef<HostComponent<NativeProps>>,
52
+ speed: Float
53
+ ) => void;
54
+ getCurrentPosition: (
55
+ viewRef: React.ElementRef<HostComponent<NativeProps>>
56
+ ) => void;
57
+ getDuration: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
58
+ isPlaying: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
59
+ getPlaybackSpeed: (
60
+ viewRef: React.ElementRef<HostComponent<NativeProps>>
61
+ ) => void;
62
+ setNewAccessToken: (
63
+ viewRef: React.ElementRef<HostComponent<NativeProps>>,
64
+ newToken: string
65
+ ) => void;
66
+ }
67
+
68
+ export const Commands = codegenNativeCommands<TPStreamsPlayerViewCommands>({
69
+ supportedCommands: [
70
+ 'play',
71
+ 'pause',
72
+ 'seekTo',
73
+ 'setPlaybackSpeed',
74
+ 'getCurrentPosition',
75
+ 'getDuration',
76
+ 'isPlaying',
77
+ 'getPlaybackSpeed',
78
+ 'setNewAccessToken',
79
+ ],
80
+ });
81
+
82
+ export default codegenNativeComponent<NativeProps>('TPStreamsRNPlayerView');