Skip to content
React component wrapper for aliplayer.
TypeScript JavaScript CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.babelrc.js
.gitignore
.npmignore
README.md
package-lock.json
package.json
tsconfig.json

README.md

ALIPLAYER-REACT

React component wrapper for aliplayer.

Current version: 2.8.2

Installation

npm i aliplayer-react

Usage

Edit aliplayer-react

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import Player from 'aliplayer-react';

const config = {
    source: "//player.alicdn.com/video/aliyunmedia.mp4",
    width: "100%",
    height: "500px",
    autoplay: true,
    isLive: false,
    rePlay: false,
    playsinline: true,
    preload: true,
    controlBarVisibility: "hover",
    useH5Prism: true,
    components: [
        {
            name: "RateComponent",
            type: Player.components.RateComponent,
        }
    ]
};

class App extends Component {
    state = {
        instance: null,  // player instance, e.g: player.stop();
    }
    render() {
        return <div>
            <Player
                config={config}
                onGetInstance={instance => this.setState({ instance })}
            />
        </div>
    }
}

ReactDOM.render(<App />, document.getElementById('root'));
You can’t perform that action at this time.