📺react-native-video二次开发视频播放器,交互设计参考bilibili
No link, no dependencies, only javascript
npm install react-native-video-bilibili
Expo SDK 50 | Web Online |
---|---|
https://1uokun.github.io/react-native-video-bilibili/index.html |
import Video from 'react-native-video-bilibili';
<Video
ref={'player'}
style={{width:"100%",height:300}}
source={{uri: "https://media.w3.org/2010/05/sintel/trailer.mp4"}}
/>
-
containerStyle
container style
-
style
react-native-video style
-
styles
deep merge styles with VideoPlayerStyles
-
lock🔒
🌟Lock all operations🌟
-
Property Type Arguments Description renderCenterMenus node state,props Components displayed in the middle of the player, like volume or light control renderTopMenus node state,props Components displayed in the top of the player, like title or navigation control renderBottomMenus node state,props Components displayed in the bottom of the player, like seek bar or seek time control renderSeekTime node state,props Components displayed when you slide left and right, like show each frame of picture renderLoading node state,props Components displayed when video is buffering, like show buffering loading children function state,props ({state,props})=>(<View></View>)
Pass all
state
and externalprops
of the parent component<Provider>
to the child component<Consumer>
based on context APIProvider
<Provider value={{ state:this.state, props:{ ...this.props, onCurrentTimeProgress:this.onCurrentTimeProgress, onSlidingComplete:this.onSlidingComplete, setPaused:this.setPaused }, }}> </Provider>
Consumer
<Consumer> {({state, props}) => <Animated.View> {props.renderCenterMenus(state, props)} </Animated.View> } </Consumer>
- ...video.props
- setFullScreen()
- setNavigator()
- setSetting()
-
this.player._root.doSth()
-
setPaused()
-
showMenusComponent()
-
showSeekTimerComponent()
-
onOrientationChange({width,height})
- Gesture Responder System👆
- 左右滑动进度条
- 上下滑动亮度(左)/声音(右)
- 长按加速
- 双击暂停
- Animated Component🏄
- Menus Component
- Loading Component
- add
lock
props - add
children
props
- Native volume control
- Native light control
- 弹幕