A React video component based on Plyr.
Add react-plyr
into your package.json dependencies:
npm install react-plyr --save
import Plyr from 'react-plyr';
// add the component in the render function
render() {
return (
<Plyr
type="youtube"
videoId="CDFN1VatiJA"
/>
)
}
Name | Type | Required | Default |
---|---|---|---|
type | oneOf('youtube','vimeo','video','audio') |
'youtube' |
|
className | string |
'react-plyr' |
|
videoId | string |
||
url | string |
||
poster | string |
||
sources | arrayOf |
||
onReady | func |
||
onPlay | func |
||
onPause | func |
||
onEnd | func |
||
onLoadedData | func |
||
onSeeked | func |
||
onEnterFullscreen | func |
||
onVolumeChange | func |
||
enabled | bool |
โ๏ธtrue |
|
controls | arrayOf |
['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'fullscreen'] |
|
loadSprite | bool |
โ๏ธtrue |
|
iconUrl | string |
null |
|
iconPrefix | string |
'plyr' |
|
debug | bool |
false |
|
autoplay | bool |
false |
|
preload | string |
||
seekTime | number |
10 |
|
volume | number |
5 |
|
clickToPlay | bool |
โ๏ธtrue |
|
disableContextMenu | bool |
โ๏ธtrue |
|
hideControls | bool |
โ๏ธtrue |
|
showPosterOnEnd | bool |
false |
|
keyboardShortcuts | shape |
{ focused: true, global: false} |
|
tooltips | shape |
{ controls: false, seek: true} |
|
duration | number |
null |
|
displayDuration | bool |
โ๏ธtrue |
|
storage | shape |
{ enabled: true, key: 'plyr_volume'} |
Please open an issue for support.
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.