react-native-tpstreams 0.2.20 → 0.2.22

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.
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  import { NativeModules } from 'react-native';
4
- // Export the native component with a different name to avoid conflicts
5
- export { default as TPStreamsPlayerNative } from '../spec/TPStreamsPlayerViewNativeComponent';
6
- export * from '../spec/TPStreamsPlayerViewNativeComponent';
7
-
4
+ import TPStreamsPlayerViewNativeComponent from '../spec/TPStreamsPlayerViewNativeComponent';
5
+ import NativeTPStreamsDownloads from "../spec/NativeTPStreamsDownloads.js";
6
+ export const TPStreamsPlayerNative = TPStreamsPlayerViewNativeComponent;
8
7
  // Export the wrapper component as TPStreamsPlayerView
9
8
  export { default as TPStreamsPlayerView } from "./TPStreamsPlayer.js";
10
9
  // Export the original download module
11
10
  export { pauseDownload, resumeDownload, removeDownload, isDownloaded, isDownloading, isPaused, getDownloadStatus, getAllDownloads, addDownloadProgressListener, removeDownloadProgressListener, onDownloadProgressChanged } from "./TPStreamsDownload.js";
12
11
 
13
12
  // Export the TPStreamsDownloads TurboModule directly
14
- export { default as TPStreamsDownloads } from "../spec/NativeTPStreamsDownloads.js";
13
+ export const TPStreamsDownloads = NativeTPStreamsDownloads;
15
14
  const TPStreamsModule = NativeModules.TPStreams;
16
15
  export const TPStreams = {
17
16
  initialize: organizationId => {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","default","TPStreamsPlayerNative","TPStreamsPlayerView","pauseDownload","resumeDownload","removeDownload","isDownloaded","isDownloading","isPaused","getDownloadStatus","getAllDownloads","addDownloadProgressListener","removeDownloadProgressListener","onDownloadProgressChanged","TPStreamsDownloads","TPStreamsModule","TPStreams","initialize","organizationId"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAC5C;AACA,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,4CAA4C;AAC7F,cAAc,4CAA4C;;AAE1D;AACA,SAASD,OAAO,IAAIE,mBAAmB,QAAQ,sBAAmB;AAGlE;AACA,SACEC,aAAa,EACbC,cAAc,EACdC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,yBAAyB,QAIpB,wBAAqB;;AAE5B;AACA,SAASb,OAAO,IAAIc,kBAAkB,QAAQ,qCAAkC;AAGhF,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","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","TPStreamsPlayerViewNativeComponent","NativeTPStreamsDownloads","TPStreamsPlayerNative","default","TPStreamsPlayerView","pauseDownload","resumeDownload","removeDownload","isDownloaded","isDownloading","isPaused","getDownloadStatus","getAllDownloads","addDownloadProgressListener","removeDownloadProgressListener","onDownloadProgressChanged","TPStreamsDownloads","TPStreamsModule","TPStreams","initialize","organizationId"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,OAAOC,kCAAkC,MAAM,4CAA4C;AAK3F,OAAOC,wBAAwB,MAAM,qCAAkC;AAGvE,OAAO,MAAMC,qBAAqB,GAAGF,kCAAkC;AAGvE;AACA,SAASG,OAAO,IAAIC,mBAAmB,QAAQ,sBAAmB;AAGlE;AACA,SACEC,aAAa,EACbC,cAAc,EACdC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,yBAAyB,QAIpB,wBAAqB;;AAE5B;AACA,OAAO,MAAMC,kBAAkB,GAAGf,wBAAwB;AAG1D,MAAMgB,eAAe,GAAGlB,aAAa,CAACmB,SAAS;AAE/C,OAAO,MAAMA,SAAS,GAAG;EACvBC,UAAU,EAAGC,cAAsB,IAAW;IAC5CH,eAAe,CAACE,UAAU,CAACC,cAAc,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
@@ -1,10 +1,13 @@
1
- export { default as TPStreamsPlayerNative } from '../spec/TPStreamsPlayerViewNativeComponent';
2
- export * from '../spec/TPStreamsPlayerViewNativeComponent';
1
+ /// <reference types="react-native/types/modules/Codegen" />
2
+ import type { ErrorEvent, NativeProps } from '../spec/TPStreamsPlayerViewNativeComponent';
3
+ import type { DownloadItem as TPStreamsDownloadsItem } from '../spec/NativeTPStreamsDownloads';
4
+ export declare const TPStreamsPlayerNative: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
5
+ export type { ErrorEvent, NativeProps };
3
6
  export { default as TPStreamsPlayerView } from './TPStreamsPlayer';
4
7
  export type { TPStreamsPlayerRef } from './TPStreamsPlayer';
5
8
  export { pauseDownload, resumeDownload, removeDownload, isDownloaded, isDownloading, isPaused, getDownloadStatus, getAllDownloads, addDownloadProgressListener, removeDownloadProgressListener, onDownloadProgressChanged, type DownloadItem, type DownloadProgressChange, type DownloadProgressListener, } from './TPStreamsDownload';
6
- export { default as TPStreamsDownloads } from '../spec/NativeTPStreamsDownloads';
7
- export type { DownloadItem as TPStreamsDownloadsItem } from '../spec/NativeTPStreamsDownloads';
9
+ export declare const TPStreamsDownloads: import("../spec/NativeTPStreamsDownloads").Spec;
10
+ export type { TPStreamsDownloadsItem };
8
11
  export declare const TPStreams: {
9
12
  initialize: (organizationId: string) => void;
10
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAC9F,cAAc,4CAA4C,CAAC;AAG3D,OAAO,EAAE,OAAO,IAA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Y,EAAE,sBAAsB,EAAE,CAAC;AAIvC,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.20",
3
+ "version": "0.2.22",
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');
package/src/index.tsx CHANGED
@@ -1,7 +1,15 @@
1
1
  import { NativeModules } from 'react-native';
2
- // Export the native component with a different name to avoid conflicts
3
- export { default as TPStreamsPlayerNative } from '../spec/TPStreamsPlayerViewNativeComponent';
4
- export * from '../spec/TPStreamsPlayerViewNativeComponent';
2
+
3
+ import TPStreamsPlayerViewNativeComponent from '../spec/TPStreamsPlayerViewNativeComponent';
4
+ import type {
5
+ ErrorEvent,
6
+ NativeProps,
7
+ } from '../spec/TPStreamsPlayerViewNativeComponent';
8
+ import NativeTPStreamsDownloads from '../spec/NativeTPStreamsDownloads';
9
+ import type { DownloadItem as TPStreamsDownloadsItem } from '../spec/NativeTPStreamsDownloads';
10
+
11
+ export const TPStreamsPlayerNative = TPStreamsPlayerViewNativeComponent;
12
+ export type { ErrorEvent, NativeProps };
5
13
 
6
14
  // Export the wrapper component as TPStreamsPlayerView
7
15
  export { default as TPStreamsPlayerView } from './TPStreamsPlayer';
@@ -26,8 +34,8 @@ export {
26
34
  } from './TPStreamsDownload';
27
35
 
28
36
  // Export the TPStreamsDownloads TurboModule directly
29
- export { default as TPStreamsDownloads } from '../spec/NativeTPStreamsDownloads';
30
- export type { DownloadItem as TPStreamsDownloadsItem } from '../spec/NativeTPStreamsDownloads';
37
+ export const TPStreamsDownloads = NativeTPStreamsDownloads;
38
+ export type { TPStreamsDownloadsItem };
31
39
 
32
40
  const TPStreamsModule = NativeModules.TPStreams;
33
41