GithubHelp home page GithubHelp logo

lvnini / react-native-ali-video-player Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 654 KB

License: MIT License

Shell 0.11% Java 44.59% JavaScript 1.07% TypeScript 30.45% C 0.07% Objective-C 22.67% Swift 0.07% Ruby 0.97%

react-native-ali-video-player's Introduction

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

react-native-ali-video-player's People

Contributors

lvnini avatar

Watchers

 avatar

Forkers

fx-fusion

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.