react-native-omniplayer
v0.1.2
Published
A React Native universal video player that automatically switches between react-native-video and VLC player based on format compatibility
Downloads
148
Maintainers
Readme
react-native-omniplayer
A React Native universal video player that automatically switches between react-native-video and VLC player based on format compatibility.
Installation
npm install react-native-omniplayer
Usage
import { VideoPlayer, ResizeMode } from 'react-native-omniplayer';
export default function App() {
const mp4VideoUri =
'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4';
return (
<VideoPlayer
resizeMode={ResizeMode.CONTAIN}
uri={mp4VideoUri}
onLoad={(event) => console.log('onLoad: ', event)}
onProgress={(event) => console.log('onProgress: ', event)}
onBuffer={(event) => console.log('onBuffer: ', event)}
onEnd={() => console.log('onEnd')}
onError={(event) => console.log('onError: ', event)}
/>
);
}
Props
mode
(optional): PlayerMode - Choose video player mode ('auto', 'vlc', or 'react-native-video')uri
(required): string - URL of the video to playresizeMode
(optional): ResizeMode - How to resize the video ('none', 'contain', 'cover', 'stretch')style
(optional): ViewStyle - Custom styles for the video containercontrols
(optional): boolean - Show/hide player controlsmuted
(optional): boolean - Mute/unmute videopaused
(optional): boolean - Pause/play videoplayInBackground
(optional): boolean - Continue playing when app is in background (Only for react-native-video)rate
(optional): number - Playback raterepeat
(optional): boolean - Loop video playbackvolume
(optional): number - Video volume (0.0 to 1.0)
Events
onLoad
: Called when video is loaded with duration informationonProgress
: Called with playback progress informationonBuffer
: Called when video is buffering (Only for react-native-video)onEnd
: Called when playback finishesonError
: Called when an error occurs during playback
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library