Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/bare/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ module.exports = makeMetroConfig({
extraNodeModules: {
common: path.resolve(__dirname, '../common'),
'react-native-video': path.resolve(__dirname, '../../lib/'),
'@react-native-picker/picker': path.resolve(__dirname, 'node_modules/@react-native-picker/picker'),
'@react-native-picker/picker': path.resolve(
__dirname,
'node_modules/@react-native-picker/picker',
),
},
},
watchFolders: [
Expand Down
12 changes: 6 additions & 6 deletions examples/bare/react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const project = (() => {
try {
const { configureProjects } = require("react-native-test-app");
const {configureProjects} = require('react-native-test-app');
return configureProjects({
android: {
sourceDir: "android",
sourceDir: 'android',
},
ios: {
sourceDir: "ios",
sourceDir: 'ios',
},
windows: {
sourceDir: "windows",
solutionFile: "windows/BareExample.sln",
sourceDir: 'windows',
solutionFile: 'windows/BareExample.sln',
},
});
} catch (_) {
Expand All @@ -19,5 +19,5 @@ const project = (() => {
})();

module.exports = {
...(project ? { project } : undefined),
...(project ? {project} : undefined),
};
12 changes: 8 additions & 4 deletions examples/common/BasicExample.windows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class VideoPlayer extends Component {
<TouchableOpacity
onPress={() => {
this.setState({rate: rate});
}}>
}}
>
<Text style={style}>{rate}x</Text>
</TouchableOpacity>
);
Expand All @@ -73,7 +74,8 @@ class VideoPlayer extends Component {
<TouchableOpacity
onPress={() => {
this.setState({resizeMode: resizeMode});
}}>
}}
>
<Text style={style}>{resizeMode}</Text>
</TouchableOpacity>
);
Expand All @@ -90,7 +92,8 @@ class VideoPlayer extends Component {
<TouchableOpacity
onPress={() => {
this.setState({volume: volume});
}}>
}}
>
<Text style={style}>{volume * 100}%</Text>
</TouchableOpacity>
);
Expand All @@ -106,7 +109,8 @@ class VideoPlayer extends Component {
style={styles.fullScreen}
onPress={() => {
this.setState({paused: !this.state.paused});
}}>
}}
>
<Video
source={require('./assets/videos/broadchurch.mp4')}
style={styles.fullScreen}
Expand Down
3 changes: 2 additions & 1 deletion examples/common/components/AudioTracksSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const AudioTrackSelector = ({
console.log('on audio value change ' + itemValue);
onValueChange(itemValue);
}
}}>
}}
>
{audioTracks?.length <= 0 ? (
<Picker.Item label={'empty'} value={'empty'} key={'empty'} />
) : (
Expand Down
5 changes: 3 additions & 2 deletions examples/common/components/MultiValueControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ export const MultiValueControl = <T extends number | string | ResizeMode>({

return (
<View style={styles.container}>
{values.map(value => {
{values.map((value) => {
const _style = value === selected ? selectedStyle : unselectedStyle;
return (
<TouchableOpacity
key={value}
onPress={() => {
onPress?.(value);
}}>
}}
>
<Text style={_style}>{value}</Text>
</TouchableOpacity>
);
Expand Down
18 changes: 9 additions & 9 deletions examples/common/components/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,18 @@ const _Overlay = forwardRef<VideoRef, Props>((props, ref) => {
}, []);

const toggleFullscreen = () => {
setFullscreen(prev => !prev);
setFullscreen((prev) => !prev);
};
const toggleControls = () => {
setControls(prev => !prev);
setControls((prev) => !prev);
};

const openDecoration = () => {
typeof ref !== 'function' && ref?.current?.setFullScreen(true);
};

const toggleShowNotificationControls = () => {
setShowNotificationControls(prev => !prev);
setShowNotificationControls((prev) => !prev);
};

const onSelectedAudioTrackChange = (itemValue: string | number) => {
Expand Down Expand Up @@ -200,15 +200,15 @@ const _Overlay = forwardRef<VideoRef, Props>((props, ref) => {
setResizeMode(value);
};

const toggleCache = () => setUseCache(prev => !prev);
const toggleCache = () => setUseCache((prev) => !prev);

const togglePause = () => setPaused(prev => !prev);
const togglePause = () => setPaused((prev) => !prev);

const toggleRepeat = () => setRepeat(prev => !prev);
const toggleRepeat = () => setRepeat((prev) => !prev);

const togglePoster = () => setShowPoster(prev => !prev);
const togglePoster = () => setShowPoster((prev) => !prev);

const toggleMuted = () => setMuted(prev => !prev);
const toggleMuted = () => setMuted((prev) => !prev);

return (
<>
Expand Down Expand Up @@ -318,7 +318,7 @@ const _Overlay = forwardRef<VideoRef, Props>((props, ref) => {
currentTime={currentTime}
duration={duration}
isLoading={isLoading}
videoSeek={prop => videoSeek(prop)}
videoSeek={(prop) => videoSeek(prop)}
isUISeeking={isSeeking}
/>
<View style={styles.generalControls}>
Expand Down
8 changes: 5 additions & 3 deletions examples/common/components/Seeker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@ export const Seeker = ({
<View
style={styles.seekbarContainer}
{...seekPanResponder.panHandlers}
{...styles.generalControls}>
{...styles.generalControls}
>
<View
style={styles.seekbarTrack}
onLayout={event => setSeekerWidth(event.nativeEvent.layout.width)}
pointerEvents={'none'}>
onLayout={(event) => setSeekerWidth(event.nativeEvent.layout.width)}
pointerEvents={'none'}
>
<View style={seekerStyle} pointerEvents={'none'} />
</View>
<View style={seekerPositionStyle} pointerEvents={'none'}>
Expand Down
3 changes: 2 additions & 1 deletion examples/common/components/TextTracksSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export const TextTrackSelector = ({
if (itemValue !== 'empty') {
onValueChange(itemValue);
}
}}>
}}
>
{textTracks?.length <= 0 ? (
<Picker.Item label={'empty'} value={'empty'} key={'empty'} />
) : (
Expand Down
3 changes: 2 additions & 1 deletion examples/common/components/TopControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const _TopControl: FC<Props> = ({
<TouchableOpacity
onPress={() => {
toggleControls();
}}>
}}
>
<Text style={styles.leftRightControlOption}>
{showRNVControls ? 'Hide controls' : 'Show controls'}
</Text>
Expand Down
7 changes: 4 additions & 3 deletions examples/common/components/VideoTracksSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ export const VideoTrackSelector = ({
? 'auto'
: `${selectedVideoTrack?.value}`
}
onValueChange={itemValue => {
onValueChange={(itemValue) => {
if (itemValue !== 'empty') {
onValueChange(itemValue);
}
}}>
}}
>
<Picker.Item label={'auto'} value={'auto'} key={'auto'} />
{videoTracks?.length <= 0 || videoTracks?.length <= 0 ? (
<Picker.Item label={'empty'} value={'empty'} key={'empty'} />
) : (
<Picker.Item label={'none'} value={'none'} key={'none'} />
)}
{videoTracks?.map(track => {
{videoTracks?.map((track) => {
if (!track) {
return;
}
Expand Down
11 changes: 9 additions & 2 deletions examples/expo/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ const pak = require('../../package.json');
const modules = Object.keys({...pak.peerDependencies});

// Watch the
config.watchFolders = [repoRoot, path.resolve(projectRoot, '../..'), path.resolve(projectRoot, '../common')];
config.watchFolders = [
repoRoot,
path.resolve(projectRoot, '../..'),
path.resolve(projectRoot, '../common'),
];

// Add the root node_modules to the resolver's search path
config.resolver.nodeModulesPaths = [
Expand All @@ -42,7 +46,10 @@ config.resolver.extraNodeModules = modules.reduce((acc, name) => {
return acc;
}, {});

config.resolver.extraNodeModules = {...config.resolver.extraNodeModules, 'common': path.resolve(projectRoot, '../common')}
config.resolver.extraNodeModules = {
...config.resolver.extraNodeModules,
common: path.resolve(projectRoot, '../common'),
};

// We need to make sure that only one version is loaded for peerDependencies
// So we block them at the root, and alias them to the versions in example's node_modules
Expand Down
Loading