react-native-tpstreams 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -6
- package/android/build.gradle +1 -1
- package/lib/module/TPStreamsPlayer.js +5 -5
- package/lib/module/TPStreamsPlayer.js.map +1 -1
- package/lib/module/index.js +5 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/TPStreamsPlayer.d.ts +3 -3
- package/lib/typescript/src/TPStreamsPlayer.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/TPStreamsPlayer.tsx +168 -172
- package/src/index.tsx +4 -2
package/README.md
CHANGED
|
@@ -2,24 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
Video player component for TPStreams
|
|
4
4
|
|
|
5
|
+
---
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```sh
|
|
8
10
|
npm install react-native-tpstreams
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Getting Started
|
|
16
|
+
|
|
17
|
+
### Initialize TPStreams
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
First, initialize TPStreams with your organization ID. This should be done **only once** at your app's entry point (e.g., App.js or index.js):
|
|
14
20
|
|
|
15
21
|
```js
|
|
16
22
|
import { TPStreams } from "react-native-tpstreams";
|
|
17
23
|
|
|
18
24
|
// Initialize with your organization ID
|
|
25
|
+
// Do this only once at your app's entry point
|
|
19
26
|
TPStreams.initialize('YOUR_ORGANIZATION_ID');
|
|
20
27
|
```
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
### Add the Player Component
|
|
30
|
+
|
|
31
|
+
Then add the player component to your app:
|
|
23
32
|
|
|
24
33
|
```js
|
|
25
34
|
import { TPStreamsPlayerView } from "react-native-tpstreams";
|
|
@@ -32,6 +41,100 @@ import { TPStreamsPlayerView } from "react-native-tpstreams";
|
|
|
32
41
|
/>
|
|
33
42
|
```
|
|
34
43
|
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Player Methods
|
|
47
|
+
|
|
48
|
+
- `play()`: Starts video playback.
|
|
49
|
+
|
|
50
|
+
- `pause()`: Pauses video playback.
|
|
51
|
+
|
|
52
|
+
- `seekTo(positionMs: number)`: Seeks to position in milliseconds.
|
|
53
|
+
|
|
54
|
+
- `setPlaybackSpeed(speed: number)`: Sets playback speed (e.g., 0.5, 1.0, 2.0).
|
|
55
|
+
|
|
56
|
+
- `getCurrentPosition()`: Gets current position in milliseconds. Returns `Promise<number>`.
|
|
57
|
+
|
|
58
|
+
- `getDuration()`: Gets video duration in milliseconds. Returns `Promise<number>`.
|
|
59
|
+
|
|
60
|
+
- `isPlaying()`: Checks if video is currently playing. Returns `Promise<boolean>`.
|
|
61
|
+
|
|
62
|
+
- `getPlaybackSpeed()`: Gets current playback speed. Returns `Promise<number>`.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Player Events
|
|
67
|
+
|
|
68
|
+
- `onPlayerStateChanged(state: number)`: Fires when player state changes.
|
|
69
|
+
|
|
70
|
+
- `onIsPlayingChanged(isPlaying: boolean)`: Fires when playing state changes.
|
|
71
|
+
|
|
72
|
+
- `onPlaybackSpeedChanged(speed: number)`: Fires when playback speed changes.
|
|
73
|
+
|
|
74
|
+
- `onIsLoadingChanged(isLoading: boolean)`: Fires when loading state changes.
|
|
75
|
+
|
|
76
|
+
- `onError(error: {message: string, code: number, details?: string})`: Fires when an error occurs.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Example
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
import { useRef } from 'react';
|
|
84
|
+
import { View, Button } from 'react-native';
|
|
85
|
+
import { TPStreamsPlayerView } from 'react-native-tpstreams';
|
|
86
|
+
import type { TPStreamsPlayerRef } from 'react-native-tpstreams';
|
|
87
|
+
|
|
88
|
+
function TPStreamsPlayerExample() {
|
|
89
|
+
const playerRef = useRef<TPStreamsPlayerRef>(null);
|
|
90
|
+
|
|
91
|
+
const handlePlay = () => {
|
|
92
|
+
playerRef.current?.play();
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const handlePause = () => {
|
|
96
|
+
playerRef.current?.pause();
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const handleSeek = () => {
|
|
100
|
+
playerRef.current?.seekTo(30000); // 30 seconds
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const checkPosition = async () => {
|
|
104
|
+
try {
|
|
105
|
+
const position = await playerRef.current?.getCurrentPosition();
|
|
106
|
+
console.log(`Current position: ${position}ms`);
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error('Error getting position:', error);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<View>
|
|
114
|
+
<TPStreamsPlayerView
|
|
115
|
+
ref={playerRef}
|
|
116
|
+
videoId="YOUR_VIDEO_ID"
|
|
117
|
+
accessToken="YOUR_ACCESS_TOKEN"
|
|
118
|
+
style={{ height: 250 }}
|
|
119
|
+
onPlayerStateChanged={(state) => console.log(`Player state: ${state}`)}
|
|
120
|
+
onIsPlayingChanged={(isPlaying) => console.log(`Is playing: ${isPlaying}`)}
|
|
121
|
+
onPlaybackSpeedChanged={(speed) => console.log(`Speed changed: ${speed}x`)}
|
|
122
|
+
onIsLoadingChanged={(isLoading) => console.log(`Loading: ${isLoading}`)}
|
|
123
|
+
onError={(error) => console.error('Player error:', error)}
|
|
124
|
+
/>
|
|
125
|
+
|
|
126
|
+
<Button title="Play" onPress={handlePlay} />
|
|
127
|
+
<Button title="Pause" onPress={handlePause} />
|
|
128
|
+
<Button title="Seek to 30s" onPress={handleSeek} />
|
|
129
|
+
<Button title="2x Speed" onPress={() => playerRef.current?.setPlaybackSpeed(2.0)} />
|
|
130
|
+
<Button title="Get Position" onPress={checkPosition} />
|
|
131
|
+
</View>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
35
138
|
## Contributing
|
|
36
139
|
|
|
37
140
|
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
@@ -40,6 +143,4 @@ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the
|
|
|
40
143
|
|
|
41
144
|
MIT
|
|
42
145
|
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
146
|
+
---
|
package/android/build.gradle
CHANGED
|
@@ -84,7 +84,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
84
84
|
dependencies {
|
|
85
85
|
implementation "com.facebook.react:react-android"
|
|
86
86
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
87
|
-
implementation "com.tpstreams:tpstreams-player:0.0.
|
|
87
|
+
implementation "com.tpstreams:tpstreams-player:0.0.3"
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
react {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { forwardRef, useImperativeHandle, useRef, useCallback } from 'react';
|
|
4
|
-
import
|
|
4
|
+
import TPStreamsPlayerNative, { Commands } from './TPStreamsPlayerViewNativeComponent';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
// Create a unique ID for each instance to track promises
|
|
7
7
|
let nextInstanceId = 0;
|
|
@@ -13,10 +13,10 @@ let nextInstanceId = 0;
|
|
|
13
13
|
// Prop types for the player component
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* TPStreamsPlayerView - React component wrapper for TPStreamsPlayerNative
|
|
17
17
|
* Provides a simple imperative API for controlling the player
|
|
18
18
|
*/
|
|
19
|
-
const
|
|
19
|
+
const TPStreamsPlayerView = /*#__PURE__*/forwardRef((props, ref) => {
|
|
20
20
|
const {
|
|
21
21
|
videoId,
|
|
22
22
|
accessToken,
|
|
@@ -150,10 +150,10 @@ const TPStreamsPlayer = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
150
150
|
onIsLoadingChanged: handleIsLoadingChanged,
|
|
151
151
|
onError: handleError
|
|
152
152
|
};
|
|
153
|
-
return /*#__PURE__*/_jsx(
|
|
153
|
+
return /*#__PURE__*/_jsx(TPStreamsPlayerNative, {
|
|
154
154
|
...nativeProps,
|
|
155
155
|
ref: nativeRef
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
|
-
export default
|
|
158
|
+
export default TPStreamsPlayerView;
|
|
159
159
|
//# sourceMappingURL=TPStreamsPlayer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useImperativeHandle","useRef","useCallback","
|
|
1
|
+
{"version":3,"names":["forwardRef","useImperativeHandle","useRef","useCallback","TPStreamsPlayerNative","Commands","jsx","_jsx","nextInstanceId","TPStreamsPlayerView","props","ref","videoId","accessToken","style","onPlayerStateChanged","onIsPlayingChanged","onPlaybackSpeedChanged","onIsLoadingChanged","onError","restProps","nativeRef","instanceId","promiseMap","onCurrentPosition","event","key","current","handler","resolve","nativeEvent","position","onDuration","duration","onIsPlaying","isPlaying","onPlaybackSpeed","speed","handlePlayerStateChanged","playbackState","handleIsPlayingChanged","handlePlaybackSpeedChanged","handleIsLoadingChanged","isLoading","handleError","message","code","details","Object","entries","forEach","reject","Error","createPromiseMethod","command","eventKey","Promise","setTimeout","play","pause","seekTo","positionMs","setPlaybackSpeed","getCurrentPosition","getDuration","getPlaybackSpeed","nativeProps"],"sourceRoot":"../../src","sources":["TPStreamsPlayer.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAC5E,OAAOC,qBAAqB,IAC1BC,QA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C,KAAK;IACLU,iBAAiB;IACjBQ,UAAU;IACVE,WAAW;IACXE,eAAe;IACfrB,oBAAoB,EAAEuB,wBAAwB;IAC9CtB,kBAAkB,EAAEwB,sBAAsB;IAC1CvB,sBAAsB,EAAEwB,0BAA0B;IAClDvB,kBAAkB,EAAEwB,sBAAsB;IAC1CvB,OAAO,EAAEyB;EACX,CAAC;EAED,oBAAOrC,IAAA,CAACH,qBAAqB;IAAA,GAAK8D,WAAW;IAAEvD,GAAG,EAAEU;EAAU,CAAE,CAAC;AACnE,CAAC,CAAC;AAEF,eAAeZ,mBAAmB","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { NativeModules } from 'react-native';
|
|
4
|
-
|
|
4
|
+
// Export the native component with a different name to avoid conflicts
|
|
5
|
+
export { default as TPStreamsPlayerNative } from './TPStreamsPlayerViewNativeComponent';
|
|
5
6
|
export * from './TPStreamsPlayerViewNativeComponent';
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
// Export the wrapper component as TPStreamsPlayerView
|
|
9
|
+
export { default as TPStreamsPlayerView } from "./TPStreamsPlayer.js";
|
|
7
10
|
const TPStreamsModule = NativeModules.TPStreams;
|
|
8
11
|
export const TPStreams = {
|
|
9
12
|
initialize: organizationId => {
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","default","
|
|
1
|
+
{"version":3,"names":["NativeModules","default","TPStreamsPlayerNative","TPStreamsPlayerView","TPStreamsModule","TPStreams","initialize","organizationId"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAC5C;AACA,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,sCAAsC;AACvF,cAAc,sCAAsC;;AAEpD;AACA,SAASD,OAAO,IAAIE,mBAAmB,QAAQ,sBAAmB;AAGlE,MAAMC,eAAe,GAAGJ,aAAa,CAACK,SAAS;AAE/C,OAAO,MAAMA,SAAS,GAAG;EACvBC,UAAU,EAAGC,cAAsB,IAAW;IAC5CH,eAAe,CAACE,UAAU,CAACC,cAAc,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
|
|
@@ -24,9 +24,9 @@ export interface TPStreamsPlayerProps extends ViewProps {
|
|
|
24
24
|
}) => void;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* TPStreamsPlayerView - React component wrapper for TPStreamsPlayerNative
|
|
28
28
|
* Provides a simple imperative API for controlling the player
|
|
29
29
|
*/
|
|
30
|
-
declare const
|
|
31
|
-
export default
|
|
30
|
+
declare const TPStreamsPlayerView: import("react").ForwardRefExoticComponent<TPStreamsPlayerProps & import("react").RefAttributes<TPStreamsPlayerRef>>;
|
|
31
|
+
export default TPStreamsPlayerView;
|
|
32
32
|
//# sourceMappingURL=TPStreamsPlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TPStreamsPlayer.d.ts","sourceRoot":"","sources":["../../../src/TPStreamsPlayer.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAc9C,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,kBAAkB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACzC;AAGD,MA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,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;CACZ;AAED;;;GAGG;AACH,QAAA,MAAM,mBAAmB,qHAsKvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as TPStreamsPlayerNative } from './TPStreamsPlayerViewNativeComponent';
|
|
2
2
|
export * from './TPStreamsPlayerViewNativeComponent';
|
|
3
|
-
export { default as
|
|
3
|
+
export { default as TPStreamsPlayerView } from './TPStreamsPlayer';
|
|
4
4
|
export type { TPStreamsPlayerRef } from './TPStreamsPlayer';
|
|
5
5
|
export declare const TPStreams: {
|
|
6
6
|
initialize: (organizationId: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"
|
|
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;AAI5D,eAAO,MAAM,SAAS;iCACS,MAAM,KAAG,IAAI;CAG3C,CAAC"}
|
package/package.json
CHANGED
package/src/TPStreamsPlayer.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef, useImperativeHandle, useRef, useCallback } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import TPStreamsPlayerNative, {
|
|
3
3
|
Commands,
|
|
4
4
|
} from './TPStreamsPlayerViewNativeComponent';
|
|
5
5
|
import type {
|
|
@@ -47,179 +47,175 @@ export interface TPStreamsPlayerProps extends ViewProps {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* TPStreamsPlayerView - React component wrapper for TPStreamsPlayerNative
|
|
51
51
|
* Provides a simple imperative API for controlling the player
|
|
52
52
|
*/
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
53
|
+
const TPStreamsPlayerView = forwardRef<
|
|
54
|
+
TPStreamsPlayerRef,
|
|
55
|
+
TPStreamsPlayerProps
|
|
56
|
+
>((props, ref) => {
|
|
57
|
+
const {
|
|
58
|
+
videoId,
|
|
59
|
+
accessToken,
|
|
60
|
+
style,
|
|
61
|
+
onPlayerStateChanged,
|
|
62
|
+
onIsPlayingChanged,
|
|
63
|
+
onPlaybackSpeedChanged,
|
|
64
|
+
onIsLoadingChanged,
|
|
65
|
+
onError,
|
|
66
|
+
...restProps
|
|
67
|
+
} = props;
|
|
68
|
+
|
|
69
|
+
const nativeRef = useRef(null);
|
|
70
|
+
const instanceId = useRef<number>(nextInstanceId++);
|
|
71
|
+
const promiseMap = useRef<PromiseMap>({});
|
|
72
|
+
|
|
73
|
+
// Event handlers that resolve promises
|
|
74
|
+
const onCurrentPosition = useCallback((event: any) => {
|
|
75
|
+
const key = `position-${instanceId.current}`;
|
|
76
|
+
const handler = promiseMap.current[key];
|
|
77
|
+
if (handler) {
|
|
78
|
+
handler.resolve(event.nativeEvent.position);
|
|
79
|
+
delete promiseMap.current[key];
|
|
80
|
+
}
|
|
81
|
+
}, []);
|
|
82
|
+
|
|
83
|
+
const onDuration = useCallback((event: any) => {
|
|
84
|
+
const key = `duration-${instanceId.current}`;
|
|
85
|
+
const handler = promiseMap.current[key];
|
|
86
|
+
if (handler) {
|
|
87
|
+
handler.resolve(event.nativeEvent.duration);
|
|
88
|
+
delete promiseMap.current[key];
|
|
89
|
+
}
|
|
90
|
+
}, []);
|
|
91
|
+
|
|
92
|
+
const onIsPlaying = useCallback((event: any) => {
|
|
93
|
+
const key = `isPlaying-${instanceId.current}`;
|
|
94
|
+
const handler = promiseMap.current[key];
|
|
95
|
+
if (handler) {
|
|
96
|
+
handler.resolve(event.nativeEvent.isPlaying);
|
|
97
|
+
delete promiseMap.current[key];
|
|
98
|
+
}
|
|
99
|
+
}, []);
|
|
100
|
+
|
|
101
|
+
const onPlaybackSpeed = useCallback((event: any) => {
|
|
102
|
+
const key = `playbackSpeed-${instanceId.current}`;
|
|
103
|
+
const handler = promiseMap.current[key];
|
|
104
|
+
if (handler) {
|
|
105
|
+
handler.resolve(event.nativeEvent.speed);
|
|
106
|
+
delete promiseMap.current[key];
|
|
107
|
+
}
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
// Player event handlers
|
|
111
|
+
const handlePlayerStateChanged = useCallback(
|
|
112
|
+
(event: any) => {
|
|
113
|
+
onPlayerStateChanged?.(event.nativeEvent.playbackState);
|
|
114
|
+
},
|
|
115
|
+
[onPlayerStateChanged]
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const handleIsPlayingChanged = useCallback(
|
|
119
|
+
(event: any) => {
|
|
120
|
+
onIsPlayingChanged?.(event.nativeEvent.isPlaying);
|
|
121
|
+
},
|
|
122
|
+
[onIsPlayingChanged]
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const handlePlaybackSpeedChanged = useCallback(
|
|
126
|
+
(event: any) => {
|
|
127
|
+
onPlaybackSpeedChanged?.(event.nativeEvent.speed);
|
|
128
|
+
},
|
|
129
|
+
[onPlaybackSpeedChanged]
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const handleIsLoadingChanged = useCallback(
|
|
133
|
+
(event: any) => {
|
|
134
|
+
onIsLoadingChanged?.(event.nativeEvent.isLoading);
|
|
135
|
+
},
|
|
136
|
+
[onIsLoadingChanged]
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
const handleError = useCallback(
|
|
140
|
+
(event: { nativeEvent: ErrorEvent }) => {
|
|
141
|
+
const { message, code, details } = event.nativeEvent;
|
|
142
|
+
|
|
143
|
+
// Reject any pending promises with this error
|
|
144
|
+
Object.entries(promiseMap.current).forEach(([key, handler]) => {
|
|
145
|
+
handler.reject(new Error(`${message}: ${details || 'Unknown error'}`));
|
|
77
146
|
delete promiseMap.current[key];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}, []);
|
|
107
|
-
|
|
108
|
-
// Player event handlers
|
|
109
|
-
const handlePlayerStateChanged = useCallback(
|
|
110
|
-
(event: any) => {
|
|
111
|
-
onPlayerStateChanged?.(event.nativeEvent.playbackState);
|
|
112
|
-
},
|
|
113
|
-
[onPlayerStateChanged]
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
const handleIsPlayingChanged = useCallback(
|
|
117
|
-
(event: any) => {
|
|
118
|
-
onIsPlayingChanged?.(event.nativeEvent.isPlaying);
|
|
119
|
-
},
|
|
120
|
-
[onIsPlayingChanged]
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
const handlePlaybackSpeedChanged = useCallback(
|
|
124
|
-
(event: any) => {
|
|
125
|
-
onPlaybackSpeedChanged?.(event.nativeEvent.speed);
|
|
126
|
-
},
|
|
127
|
-
[onPlaybackSpeedChanged]
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
const handleIsLoadingChanged = useCallback(
|
|
131
|
-
(event: any) => {
|
|
132
|
-
onIsLoadingChanged?.(event.nativeEvent.isLoading);
|
|
133
|
-
},
|
|
134
|
-
[onIsLoadingChanged]
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
const handleError = useCallback(
|
|
138
|
-
(event: { nativeEvent: ErrorEvent }) => {
|
|
139
|
-
const { message, code, details } = event.nativeEvent;
|
|
140
|
-
|
|
141
|
-
// Reject any pending promises with this error
|
|
142
|
-
Object.entries(promiseMap.current).forEach(([key, handler]) => {
|
|
143
|
-
handler.reject(
|
|
144
|
-
new Error(`${message}: ${details || 'Unknown error'}`)
|
|
145
|
-
);
|
|
146
|
-
delete promiseMap.current[key];
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// Forward the error to the client if they provided an onError handler
|
|
150
|
+
onError?.({ message, code, details });
|
|
151
|
+
},
|
|
152
|
+
[onError]
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
// Helper to create promise-based API methods
|
|
156
|
+
const createPromiseMethod = useCallback(
|
|
157
|
+
(command: (ref: any) => void, eventKey: string) => {
|
|
158
|
+
return () =>
|
|
159
|
+
new Promise<any>((resolve, reject) => {
|
|
160
|
+
if (nativeRef.current) {
|
|
161
|
+
const key = `${eventKey}-${instanceId.current}`;
|
|
162
|
+
promiseMap.current[key] = { resolve, reject };
|
|
163
|
+
command(nativeRef.current);
|
|
164
|
+
|
|
165
|
+
// Set a timeout to reject the promise if it's not resolved in time
|
|
166
|
+
setTimeout(() => {
|
|
167
|
+
if (promiseMap.current[key]) {
|
|
168
|
+
reject(new Error(`Timeout getting ${eventKey}`));
|
|
169
|
+
delete promiseMap.current[key];
|
|
170
|
+
}
|
|
171
|
+
}, 5000);
|
|
172
|
+
} else {
|
|
173
|
+
reject(new Error('Player is not initialized'));
|
|
174
|
+
}
|
|
147
175
|
});
|
|
176
|
+
},
|
|
177
|
+
[]
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
useImperativeHandle(
|
|
181
|
+
ref,
|
|
182
|
+
() => ({
|
|
183
|
+
play: () => nativeRef.current && Commands.play(nativeRef.current),
|
|
184
|
+
pause: () => nativeRef.current && Commands.pause(nativeRef.current),
|
|
185
|
+
seekTo: (positionMs: number) =>
|
|
186
|
+
nativeRef.current && Commands.seekTo(nativeRef.current, positionMs),
|
|
187
|
+
setPlaybackSpeed: (speed: number) =>
|
|
188
|
+
nativeRef.current &&
|
|
189
|
+
Commands.setPlaybackSpeed(nativeRef.current, speed),
|
|
190
|
+
getCurrentPosition: createPromiseMethod(
|
|
191
|
+
Commands.getCurrentPosition,
|
|
192
|
+
'position'
|
|
193
|
+
),
|
|
194
|
+
getDuration: createPromiseMethod(Commands.getDuration, 'duration'),
|
|
195
|
+
isPlaying: createPromiseMethod(Commands.isPlaying, 'isPlaying'),
|
|
196
|
+
getPlaybackSpeed: createPromiseMethod(Commands.getPlaybackSpeed, 'speed'),
|
|
197
|
+
}),
|
|
198
|
+
[createPromiseMethod]
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
// Create native props object with the correct types
|
|
202
|
+
const nativeProps: NativeProps = {
|
|
203
|
+
...restProps,
|
|
204
|
+
videoId,
|
|
205
|
+
accessToken,
|
|
206
|
+
style,
|
|
207
|
+
onCurrentPosition,
|
|
208
|
+
onDuration,
|
|
209
|
+
onIsPlaying,
|
|
210
|
+
onPlaybackSpeed,
|
|
211
|
+
onPlayerStateChanged: handlePlayerStateChanged,
|
|
212
|
+
onIsPlayingChanged: handleIsPlayingChanged,
|
|
213
|
+
onPlaybackSpeedChanged: handlePlaybackSpeedChanged,
|
|
214
|
+
onIsLoadingChanged: handleIsLoadingChanged,
|
|
215
|
+
onError: handleError,
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
return <TPStreamsPlayerNative {...nativeProps} ref={nativeRef} />;
|
|
219
|
+
});
|
|
148
220
|
|
|
149
|
-
|
|
150
|
-
onError?.({ message, code, details });
|
|
151
|
-
},
|
|
152
|
-
[onError]
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
// Helper to create promise-based API methods
|
|
156
|
-
const createPromiseMethod = useCallback(
|
|
157
|
-
(command: (ref: any) => void, eventKey: string) => {
|
|
158
|
-
return () =>
|
|
159
|
-
new Promise<any>((resolve, reject) => {
|
|
160
|
-
if (nativeRef.current) {
|
|
161
|
-
const key = `${eventKey}-${instanceId.current}`;
|
|
162
|
-
promiseMap.current[key] = { resolve, reject };
|
|
163
|
-
command(nativeRef.current);
|
|
164
|
-
|
|
165
|
-
// Set a timeout to reject the promise if it's not resolved in time
|
|
166
|
-
setTimeout(() => {
|
|
167
|
-
if (promiseMap.current[key]) {
|
|
168
|
-
reject(new Error(`Timeout getting ${eventKey}`));
|
|
169
|
-
delete promiseMap.current[key];
|
|
170
|
-
}
|
|
171
|
-
}, 5000);
|
|
172
|
-
} else {
|
|
173
|
-
reject(new Error('Player is not initialized'));
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
},
|
|
177
|
-
[]
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
useImperativeHandle(
|
|
181
|
-
ref,
|
|
182
|
-
() => ({
|
|
183
|
-
play: () => nativeRef.current && Commands.play(nativeRef.current),
|
|
184
|
-
pause: () => nativeRef.current && Commands.pause(nativeRef.current),
|
|
185
|
-
seekTo: (positionMs: number) =>
|
|
186
|
-
nativeRef.current && Commands.seekTo(nativeRef.current, positionMs),
|
|
187
|
-
setPlaybackSpeed: (speed: number) =>
|
|
188
|
-
nativeRef.current &&
|
|
189
|
-
Commands.setPlaybackSpeed(nativeRef.current, speed),
|
|
190
|
-
getCurrentPosition: createPromiseMethod(
|
|
191
|
-
Commands.getCurrentPosition,
|
|
192
|
-
'position'
|
|
193
|
-
),
|
|
194
|
-
getDuration: createPromiseMethod(Commands.getDuration, 'duration'),
|
|
195
|
-
isPlaying: createPromiseMethod(Commands.isPlaying, 'isPlaying'),
|
|
196
|
-
getPlaybackSpeed: createPromiseMethod(
|
|
197
|
-
Commands.getPlaybackSpeed,
|
|
198
|
-
'speed'
|
|
199
|
-
),
|
|
200
|
-
}),
|
|
201
|
-
[createPromiseMethod]
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
// Create native props object with the correct types
|
|
205
|
-
const nativeProps: NativeProps = {
|
|
206
|
-
...restProps,
|
|
207
|
-
videoId,
|
|
208
|
-
accessToken,
|
|
209
|
-
style,
|
|
210
|
-
onCurrentPosition,
|
|
211
|
-
onDuration,
|
|
212
|
-
onIsPlaying,
|
|
213
|
-
onPlaybackSpeed,
|
|
214
|
-
onPlayerStateChanged: handlePlayerStateChanged,
|
|
215
|
-
onIsPlayingChanged: handleIsPlayingChanged,
|
|
216
|
-
onPlaybackSpeedChanged: handlePlaybackSpeedChanged,
|
|
217
|
-
onIsLoadingChanged: handleIsLoadingChanged,
|
|
218
|
-
onError: handleError,
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
return <TPStreamsPlayerView {...nativeProps} ref={nativeRef} />;
|
|
222
|
-
}
|
|
223
|
-
);
|
|
224
|
-
|
|
225
|
-
export default TPStreamsPlayer;
|
|
221
|
+
export default TPStreamsPlayerView;
|
package/src/index.tsx
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
|
-
|
|
2
|
+
// Export the native component with a different name to avoid conflicts
|
|
3
|
+
export { default as TPStreamsPlayerNative } from './TPStreamsPlayerViewNativeComponent';
|
|
3
4
|
export * from './TPStreamsPlayerViewNativeComponent';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
// Export the wrapper component as TPStreamsPlayerView
|
|
7
|
+
export { default as TPStreamsPlayerView } from './TPStreamsPlayer';
|
|
6
8
|
export type { TPStreamsPlayerRef } from './TPStreamsPlayer';
|
|
7
9
|
|
|
8
10
|
const TPStreamsModule = NativeModules.TPStreams;
|