我想给我的videojs播放器时间添加标记。我已经看到了如何实现它,并且几个月前已经实现了它,当时它起作用了。现在在我的另一个项目中,我想使用相同的。但它在控制台中给了我错误,就像这样(如下所示),并且我不能在玩家时间线上看到我的标记。
?
?
class Player extends Component {
constructor() {
super();
this.state = {
player: {}
};
}
componentDidMount() {
var self = this;
var player = videojs(this.refs.video, this.props.options).ready(function () {
self.player = this;
self.player.on('play', self.handlePlay);
});
// $.get('URL-TO-FETCH-DATA-FROM', function(result) {
// if (this.isMounted()) {
// this.setState({
// dataVar1: result
// });
// }
// }.bind(this));
if (this.props.onPlayerInit) this.props.onPlayerInit(player);
player.markers({
markerStyle: {},
markers: this.props.marker_store,
onMarkerReached: function () {
// player.pause();
},
});
this.setState({player: player});
}
handlePlay() {
console.log("handle play ")
}
render() {
var props = blacklist(this.props, 'children', 'className', 'src', 'type', 'onPlay');
props.className = cx(this.props.className, 'videojs', 'video-js vjs-default-skin', 'vjs-big-play-centered');
assign(props, {
ref: 'video',
controls: true,
});
return (
<video {... props}>
<source src={videoSrc} type="video/mp4"/>
</video>
)
}
}
const mapStateToProps = (state) => {
return {
marker_store:state.markerReducer
};
};
export default connect(mapStateToProps)(Player);
这些是抛出videojs not defined错误的markers.js插件代码
};
}
videojs.plugin('markers', registerVideoJsMarkersPlugin);
})(jQuery, window.videojs);
我应该如何解决它,以便我能够看到我的球员上的标记?
转载请注明出处:http://www.yojatech.com/article/20230526/2392167.html