1.0.1 • Published 3 years ago

react-native-apsara-player v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

react-native-apsara-player

A react-native wrapper around aliyun video player

Check the example for more details

Installation

yarn add react-native-apsara-player
npx pod-install

Usage example

import React from 'react'
import ApsaraPlayer from 'react-native-apsara-player';

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',
  },
}

export default class extends React.Component {
  render() {
    return (
      <ApsaraPlayer
        ref={ref => {
          this.player = ref
        })
        source={uriSource /* or stsSource or authSource */}
        paused={true}
        onEnd={this._onEnd}
        onLoad={this._onLoad}
        onSeek={this._onSeek}
        onError={this._onError}
        onProgress={this._onProgress}
      />
    )
  }
};

Component props

propdefaulttypedescription
pausedfalseBooleanWhether the video is paused
repeatfalseBooleanWhether to repeat the video
mutedfalseBooleanWhether the audio is muted
volume1NumberAdjust the volume
sourcenoneObjectSource of the video
onEndnoneFunctionCallback function that is called when the player reaches the end of the media
onLoadnoneFunctionCallback function that is called when the video is loaded
onSeeknoneFunctionCallback function that is called when a seek completes
onErrornoneFunctionFunction that is invoked when the video load fails
onProgressnoneFunctionFunction that is invoked when the video is updates

Requirements

  • react-native >= 0.60.0

License

MIT

1.0.1

3 years ago

1.0.0

3 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago