我想在我的反应电视项目中有一个视频播放器,我需要自定义它,我使用react-html5video并且它工作正常,但控制如暂停,全屏,视频,寻求...没有他们工作,我得到这个错误,例如暂停点击:
“未捕获的TypeError:无法读取未定义的属性'暂停' 在togglePause(bundle.js:29547) 在HTMLDivElement.onPlayPauseClick“
这是我的代码(它是一个带有反应的smarttv应用程序),我很反应,很抱歉,如果这很愚蠢:
import {
apiHelpers,
Captions,
Controls,
DefaultPlayer as Video,
Fullscreen,
Mute,
Overlay,
Play,
PlayPause,
seek,
Subtitles,
Time,
Volume,
} from 'react-html5video'
class ReactMovie extends React.Component {
constructor(props) {
super(props)
this.state = { videoEl: '', }
this.videoitem = this.videoitem.bind(this)
}
videoitem(e) {
const videoelement = e.videoEl
this.setState({ videoEl: videoelement })
}
render() {
return (
<Video videoEl={this.state.videoEl} id="thisvideo"
ref={this.videoitem} autoPlay loop muted
controls={['PlayPause', 'Seek', 'Time', 'Volume',
'Fullscreen', 'Captions']}
playsinline={false}
poster="/react-tv/image/myimage.jpg"
onPlay={() => console.log("playing")}>
<source src="/react-tv/video/streamer.mp4"
type="video/mp4"/>
<track label="English" kind="subtitles" srcLang="en"
src="/react-tv/video/streamer.mp4" default/>
</Video>
)
}
}
ReactTV.render(<ReactMovie/>, document.querySelector('#root'))