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
backgroundColor
for 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 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,
}}
/>
</View>
);
const styles = StyleSheet.create({
wrapper: {
// ...
},
playControl: {
// ...
},
seekBarKnob: {
// ...
},
});
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.