react-imusic
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

React-IMusic

React-IMusic is an HTML5 Audio integration component.

Install

Simply install it using npm/yarn.

npm install react-imusic

Usage

import Music from 'react-imuisc';
 
<Music
    src={list[index].url}
    play={play}
    onProgress={d => {
        // ...
    }}
/>

Example

You can also directly view the Example code.

API

Props

name type default description
src string null @required
play bool false
autoPlay bool false
preload bool true
initSeek number 0
onProgress function d => d,
onError function e => e,
onLoadStart function e => e,
onLoadMetaData function e => e,
onLoad function e => e,
onPlay function e => e,
onPause function e => e,
onEnd function e => e,
onCanplay function e => e,
onCanplayThrough function e => e,
onRateChange function e => e,
onDurationChange function e => e,
onVolumeChange function e => e,
onSuspend function e => e,
onWaiting function e => e,
onPlaying function e => e,
onSeeking function e => e,
onSeeked function e => e,

onProgress callback param data:

{
    currentTime: number,
    duration: number,
    seeking: boolean,
    buffered: number,
    seekable: number,
    percent: number,
    networkState: number,
}

Module

name params description
reLoad ()
isPlay ()
seek (val: number)

Readme

Keywords

Package Sidebar

Install

npm i react-imusic

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

9.45 kB

Total Files

4

Last publish

Collaborators

  • lizhooh