为React Native定制的视频控件使用方法

963 阅读1分钟

Custom Video Control For React Native

用于React Native视频播放器的控制元素和实用工具。

包括的组件

  • 视频控件
  • 控制滑块
  • ControlThumb
  • 控制视频状态
  • 控制全屏
  • 控制触摸

钩子包括

  • 钩子包括: useControlSlider
  • 使用控件视频状态
  • useControlFullScreen
  • useControlThumb
  • 使用布局
  • useTapGesture / useLongPressGesture
  • 使用时间从拇指开始
  • 使用控件可见性
  • 使用夹子手势

安装

# Yarn
$ yarn add @premieroctet/react-native-video-controls

# NPM
$ npm i @premieroctet/react-native-video-controls

基本使用方法

<VideoControls
  componentsProps={componentProps}
  components={components}
  onFastForward={onFastForward}
  onFastRewind={onFastRewind}
  videoElement={
    <Video
      source={{
        uri: '/path/to/video.mp4',
      }}
      useNativeControls={false}
      onLoad={onLoad}
      onPlaybackStatusUpdate={onPlaybackStatusUpdate}
      shouldPlay
      rotation={isFullScreen ? 90 : 0}
      style={[
        { width: '100%' },
        isFullScreen
          ? {
              height: '100%',
            }
          : { aspectRatio: 16 / 9 },
      ]}
      ref={videoRef}
      pointerEvents="none"
    />
  }
/>

预览

image.png

The postCustom Video Control For React Nativeappeared first onReactScript.