1.0.5 • Published 14 days ago

react-native-ali-video-player v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

Installation

npm install react-native-ali-video-player

Usage

import VideoPlayer from 'react-native-ali-video-player';

const refPlayer = React.useRef<VideoPlayerHandler>(null);
const uriSource = { uri: "https://player.alicdn.com/video/aliyunmedia.mp4" }

const stsSource = {
  sts: {
    vid: 'YOUR_VID'
    region: 'YOUR_REGION',
    accessKeyId: 'YOUR_ACCESS_KEY_ID',
    accessKeySecret: 'YOUR_ACCESS_KEY_SECRET',
    securityToken: 'YOUR_SECURITY_TOKEN',
  },
}

const authSource = {
  auth: {
    vid: 'YOUR_VID'
    region: 'YOUR_REGION',
    playAuth: 'YOUR_PLAY_AUTH',
  },
}

<VideoPlayer
  ref={refPlayer}
  isHiddenBack
  isLandscape
  enableBackground={true}
  source={uriSource /* or stsSource or authSource */}
  setAutoPlay={true}
  showTiming={true}
  onCompletion={() => {
    console.log('onCompletion');
  }}
  onError={(error: any) => {
    console.log('error', error);
  }}
  onProgress={(error: any) => {
    console.log('onProgress', error);
  }}
  onAliBitrateReady={e => {
    console.log('onAliBitrateReady', e.nativeEvent.bitrates);
  }}
  onAliLoadingEnd={e => {
    console.log('onAliLoadingEnd', e);
  }}
  onBufferProgress={(progress: any) => {
    console.log('onBufferProgress', progress);
  }}
  onPrepare={(duration: any) => {
    console.log('onPrepare', duration);
  }}
  style={[styles.box, {width: layout.width, height: 200}]}
/>

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

1.0.5

14 days ago

1.0.4

1 month ago

1.0.3

1 month ago

1.0.1

1 month ago