API - Styles
The react-native-video-player component allows you to customize its appearance using the customStyles property.
Custom Stylesβ
wrapperβ
- Description: Styles the main container that wraps the entire video player.
videoWrapperβ
- Description: Styles the container that holds the video element and controls.
videoβ
- Description: Styles the video element itself. Supports properties like
backgroundColorfor older Android versions.
controlsβ
- Description: Styles the container for the control elements (play, pause, seek bar, etc.).
playControlβ
- Description: Styles the play/pause button within the controls.
controlButtonβ
- Description: Styles for all buttons in the controls (e.g., mute, fullscreen).
controlIconβ
- Description: Styles for the icons inside the control buttons, such as the volume or fullscreen icons.
playIconβ
- Description: Styles specifically for the play/pause icon on the start button.
seekBarβ
- Description: Styles the seek bar container, which shows the progress of the video.
seekBarFullWidthβ
- Description: Styles the seek bar when it spans the full width (e.g., in fullscreen mode).
seekBarProgressβ
- Description: Styles the bar indicating playback progress.
seekBarKnobβ
- Description: Styles the draggable knob used to seek (move playback position).
seekBarKnobSeekingβ
- Description: Styles the knob when the user is actively seeking (dragging the knob).
seekBarBackgroundβ
- Description: Styles the background of the seek bar.
thumbnailβ
- Description: Styles the video thumbnail container shown before playback starts.
thumbnailImageβ
- Description: Styles the video thumbnail image shown before playback starts.
playButtonβ
- Description: Styles the start button overlaying the thumbnail.
playArrowβ
- Description: Styles the play arrow icon inside the start button.
durationTextβ
- Description: Styles the text displaying the video duration.
Example Usageβ
Hereβs an example of how to apply custom styles:
import React from 'react';
import { View, StyleSheet } from 'react-native';
import VideoPlayer from 'react-native-video-player';
const App = () => (
<View style={{ flex: 1 }}>
<VideoPlayer
source={{ uri: 'https://example.com/video.mp4' }}
thumbnail={{ uri: 'https://example.com/thumbnail.jpg' }}
autoplay
customStyles={{
wrapper: styles.wrapper,
playControl: styles.playControl,
seekBarKnob: styles.seekBarKnob,
thumbnailImage: styles.thumbnailImage
}}
/>
</View>
);
const styles = StyleSheet.create({
wrapper: {
// ...
},
playControl: {
// ...
},
seekBarKnob: {
// ...
},
thumbnailImage: {
resizeMode: 'contain',
// ...
},
});
export default App;
With the customStyles property, you have complete control over how the player looks and feels, ensuring it integrates seamlessly into your app's design.