React VideoJS on Modal Dialog. Based from react-video-js, I tweak it a bit.
This package is react-based (react & videojs only)
.
If you are looking for react
wrapper of jquery + fancybox
, try to use react-videojs-fancybox instead.
Check the Demo
npm install --save react-modal-videojs
import React, { Component } from 'react'
import ModalVideo from 'react-modal-videojs'
export default class App extends Component {
constructor(props){
super(props)
this.state = {
src: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4",
poster: "https://raw.githubusercontent.com/waskito/react-modal-videojs/master/example/public/preview.png",
show: false
}
}
showModal = () => {
this.setState({ show: true });
}
hideModal = () => {
this.setState({ show: false });
}
render () {
const { poster, src, show } = this.state;
return (
<div>
<h1>React Modal VideoJS</h1>
<div className="container">
<ModalVideo
id={ (new Date() *1).toString() }
src={src}
poster={poster}
show={show}
showModal={this.showModal}
handleClose={this.hideModal}
/>
</div>
</div>
)
}
}
modalBackdropClass
: String, default''
.modalContentClass
: String, default''
.modalCloseButtonClass
: String, default''
.fade
: Boolean, defaulttrue
.alt
: String, default''
.noOuterClose
: Boolean, defaultfalse
. (Disable close modal when click on the backdrop)
id
: (required) String.source
: (required) String.sourceHD
: String, default''
.poster
: String, defaultnull
.responsive
: Boolean, defaultfalse
.fluid
: Boolean, defaulttrue
.fill
: Boolean, defaulttrue
.skin
: String, defaultdefault
.autoplay
: Boolean, defaulttrue
.bigPlayButton
: Boolean, defaultfalse
(Becauseautoplay
istrue
).customSkinClass
: String, default''
.height
: Number, defaultnull
.width
: Number, defaultnull
.loop
: Boolean, defaultfalse
.onReady
: Functon,callback(videoJsPlayer)
.resize
: Boolean, defaulttrue
.options
: Boolean, defaultonEnded
: Function,callback(videoJsPlayer)
.onPlay
: Function,callback(videoJsPlayer)
.onPause
: Function,callback(videoJsPlayer)
.debounce
: Number, default300
.bigPlayButtonCentered
: Boolean, defaultfalse
.
MIT © waskito