0.0.1 • Published 5 years ago

media-player-react v0.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

media-player-react

react 媒体组件

Usage

npm install media-player-react --save
# or
yarn add media-player-react
import React, { Component } from 'react'
import {MediaPlayer} from 'media-player-react'

class App extends Component {
  render () {
    return <MediaPlayer url='http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'/>
  }
}

Props

PropDescriptionDefault
urlThe url of a video or song to play
<!-- playingSet to true or false to pause or play the mediafalse
loopSet to true or false to loop the mediafalse
controlsSet to true or false to display native player controls  Vimeo, Twitch and Wistia player will always display controlsfalse
lightSet to true to show just the video thumbnail, which loads the full player on click  Pass in an image URL to override the preview imagefalse
volumeSet the volume of the player, between 0 and 1  null uses default volume on all players #357null
mutedMutes the player  Only works if volume is setfalse
playbackRateSet the playback rate of the player  Only supported by YouTube, Wistia, and file paths1
widthSet the width of the player640px
heightSet the height of the player360px
styleAdd inline styles to the root element{}
progressIntervalThe time between onProgress callbacks, in milliseconds1000
playsinlineApplies the playsinline attribute where supportedfalse
pipSet to true or false to enable or disable picture-in-picture modefalse
wrapperElement or component to use as the container elementdiv
configOverride options for the various players, see config prop -->