Javascript Video.js+;反应&;Redux:无法读取属性';vttjs';未定义的

Javascript Video.js+;反应&;Redux:无法读取属性';vttjs';未定义的,javascript,reactjs,redux,react-redux,video.js,Javascript,Reactjs,Redux,React Redux,Video.js,第1部分: 我正在尝试构建一个使用video.js视频播放器的React组件 选择此库是因为它提供了一些开箱即用的功能。特别是视频格式转换和缓存 为了实现这一点,我使用了Video.js“official docs(或更像即将成为官方文档)中的代码@: 从“React”导入React 从“video.js”导入videojs 导出默认类VideoPlayer扩展React.Component{ componentDidMount(){ //实例化video.js this.player=vide

第1部分: 我正在尝试构建一个使用video.js视频播放器的React组件

选择此库是因为它提供了一些开箱即用的功能。特别是视频格式转换和缓存

为了实现这一点,我使用了Video.js“official docs(或更像即将成为官方文档)中的代码@:

从“React”导入React
从“video.js”导入videojs
导出默认类VideoPlayer扩展React.Component{
componentDidMount(){
//实例化video.js
this.player=videojs(this.videoNode,this.props,函数onPlayerReady()){
console.log('onPlayerReady',this)
})
}
//卸载时摧毁玩家
组件将卸载(){
if(this.player){
this.player.dispose()
}
}
//使用'datavjsplayer'属性将播放器包装在div中
//所以videojs不会在DOM中创建额外的包装器
//看https://github.com/videojs/video.js/pull/3856
render(){
返回(
this.videoNode=node}className=“video js”>
)
}
}
然而,当我运行这段代码时,组件似乎工作得很好,但我在控制台中遇到了这个错误:VIDEOJS:error:TypeError:cannotread属性“vttjs”的undefined

完整堆栈跟踪:

VIDEOJS: ERROR: TypeError: Cannot read property 'vttjs' of undefined
    at Object.<anonymous> (vtt.js:1481)
    at __webpack_require__ (bootstrap 9672f7f…:555)
    at fn (bootstrap 9672f7f…:86)
    at Object.<anonymous> (index.js:22)
    at __webpack_require__ (bootstrap 9672f7f…:555)
    at fn (bootstrap 9672f7f…:86)
    at tech.js:648
    at Html5.addWebVttScript_ (tech.js:647)
    at HTMLVideoElement.bound (fn.js:32)
    at HTMLVideoElement.data.dispatcher (events.js:284)
VIDEOJS:ERROR:TypeError:无法读取未定义的属性“vttjs”

在对象上。

似乎有一个Github问题线程与此相关。希望这有助于:
VIDEOJS: ERROR: TypeError: Cannot read property 'vttjs' of undefined
    at Object.<anonymous> (vtt.js:1481)
    at __webpack_require__ (bootstrap 9672f7f…:555)
    at fn (bootstrap 9672f7f…:86)
    at Object.<anonymous> (index.js:22)
    at __webpack_require__ (bootstrap 9672f7f…:555)
    at fn (bootstrap 9672f7f…:86)
    at tech.js:648
    at Html5.addWebVttScript_ (tech.js:647)
    at HTMLVideoElement.bound (fn.js:32)
    at HTMLVideoElement.data.dispatcher (events.js:284)