Skip to content

Commit

Permalink
Merge branch 'master' into feat/add-caption-control
Browse files Browse the repository at this point in the history
  • Loading branch information
LunatiqueCoder committed Jul 13, 2024
2 parents fde8853 + 5efeb5d commit 6234d4f
Show file tree
Hide file tree
Showing 10 changed files with 452 additions and 421 deletions.
4 changes: 2 additions & 2 deletions examples/VanillaVideoplayer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vanillavideoplayer",
"version": "2.2.0",
"version": "2.2.4",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand All @@ -12,7 +12,7 @@
"dependencies": {
"react": "18.2.0",
"react-native": "0.72.5",
"react-native-media-console": "^2.2.0",
"react-native-media-console": "^2.2.4",
"react-native-video": "^5.2.1"
},
"devDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-media-console",
"private": true,
"version": "2.2.0",
"version": "2.2.4",
"description": "A media player for the react-native-video component",
"license": "MIT",
"source": "src/index",
Expand Down Expand Up @@ -59,16 +59,16 @@
],
"devDependencies": {
"@react-native-community/eslint-config": "^3.2.0",
"@release-it-plugins/workspaces": "^4.0.0",
"@release-it/bumper": "^5.1.0",
"@release-it/conventional-changelog": "^7.0.2",
"@release-it-plugins/workspaces": "4.2.0",
"@release-it/bumper": "6.0.1",
"@release-it/conventional-changelog": "8.0.1",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"eslint": "^7.14.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.3",
"prettier": "^2.5.1",
"release-it": "^16.2.0",
"release-it": "17.3.0",
"turbo": "^1.10.14"
}
}
6 changes: 5 additions & 1 deletion packages/media-console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ from [react-native-video][15].

If you are using `react-native-reanimated`, then you can use `yarn add @react-native-media-console/reanimated`

> **🚧 WARNING**
>
> You need react-native-video > 6.0.0 in order to use this library.
## 🛠 Usage

The `<VideoPlayer>` component follows the API of the `<Video>` component
Expand Down Expand Up @@ -183,7 +187,7 @@ disable any controls

[10]: https://github.com/LunatiqueCoder/react-native-media-console/search?l=typescript

[11]: https://img.shields.io/maintenance/yes/2023
[11]: https://img.shields.io/maintenance/yes/2025

[12]: https://github.com/LunatiqueCoder/react-native-media-console/graphs/contributors

Expand Down
2 changes: 1 addition & 1 deletion packages/media-console/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-media-console",
"version": "2.2.0",
"version": "2.2.4",
"description": "A media player for the react-native-video component",
"license": "MIT",
"source": "src/index",
Expand Down
3 changes: 3 additions & 0 deletions packages/media-console/src/OSSupport/PlatformSupport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ interface OSSupport {
containerStyles: StyleProp<ViewStyle>;
onScreenTouch: () => void;
showControls: boolean;
testID?: string;
}

export const PlatformSupport = ({
children,
onScreenTouch,
containerStyles,
showControls,
testID,
}: OSSupport) => {
if (Platform.isTV) {
return (
Expand All @@ -35,6 +37,7 @@ export const PlatformSupport = ({

return (
<TouchableWithoutFeedback
testID={testID}
onPress={onScreenTouch}
style={[_styles.player.container, containerStyles]}>
{children}
Expand Down
22 changes: 11 additions & 11 deletions packages/media-console/src/VideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const AnimatedVideoPlayer = (
navigator,
rewindTime = 15,
pan: {horizontal: horizontalPan, inverted: invertedPan} = {},
testID,
} = props;

const mounted = useRef(false);
Expand Down Expand Up @@ -307,12 +308,14 @@ const AnimatedVideoPlayer = (
setResizeMode(_isFullscreen ? ResizeMode.COVER : ResizeMode.CONTAIN);
}

if (_isFullscreen) {
typeof events.onEnterFullscreen === 'function' &&
events.onEnterFullscreen();
} else {
typeof events.onExitFullscreen === 'function' &&
events.onExitFullscreen();
if (mounted.current) {
if (_isFullscreen) {
typeof events.onEnterFullscreen === 'function' &&
events.onEnterFullscreen();
} else {
typeof events.onExitFullscreen === 'function' &&
events.onExitFullscreen();
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [_isFullscreen, toggleResizeModeOnFullscreen]);
Expand All @@ -323,10 +326,6 @@ const AnimatedVideoPlayer = (

useEffect(() => {
setPaused(paused);
mounted.current = true;
return () => {
mounted.current = false;
};
}, [paused]);

useEffect(() => {
Expand Down Expand Up @@ -402,7 +401,8 @@ const AnimatedVideoPlayer = (
<PlatformSupport
showControls={showControls}
containerStyles={styles.containerStyle}
onScreenTouch={events.onScreenTouch}>
onScreenTouch={events.onScreenTouch}
testID={testID}>
<View style={[_styles.player.container, styles.containerStyle]}>
<Video
{...props}
Expand Down
11 changes: 5 additions & 6 deletions packages/media-console/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@
"dependencies": {},
"peerDependencies": {
"react-native": ">=0.46.0",
"react-native-video": ">=2.0.0",
"react-native-video": ">=6.0.0",
"react-native-reanimated": "^2.12.0"
},
"devDependencies": {
"@types/react-native-video": "^5.0.14",
"react": "^17.0.2",
"react-native": "npm:react-native-tvos@0.68.2-5",
"react": "18.3.1",
"react-native": "npm:react-native-tvos@0.74.1-0",
"react-native-builder-bob": "^0.18.2",
"react-native-video": "^5.2.0",
"react-native-reanimated": "^2.12.0",
"react-native-video": "6.1.2",
"react-native-reanimated": "3.11.0",
"release-it": "^15.6.0",
"typescript": "^4.6.2"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/media-console/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,8 @@ export interface VideoPlayerProps extends ReactVideoProps {
*/
inverted?: boolean;
};
/**
* testID selector for testing
*/
testID?: string;
}
4 changes: 2 additions & 2 deletions packages/reanimated/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-native-media-console/reanimated",
"version": "2.2.0",
"version": "2.2.4",
"description": "A media player for the react-native-video component",
"license": "MIT",
"source": "src/index",
Expand Down Expand Up @@ -29,7 +29,7 @@
"react-native": ">=0.46.0",
"react-native-video": ">=2.0.0",
"react-native-reanimated": "^2.12.0",
"react-native-media-console": "^2.2.0"
"react-native-media-console": "^2.2.4"
},
"devDependencies": {
"@types/react-native-video": "^5.0.14",
Expand Down
Loading

0 comments on commit 6234d4f

Please sign in to comment.