I am working on reactjs project with dashjs for playing video files. when I switch the videos getting following errors in attachView() function.
console click here for more details following code I am using : componentWillReceiveProps(nextProps) {
//console.log("nextprops", nextProps);
this.setState({ show: false });
setTimeout(function () { this.setState({ show: true }); }.bind(this), 500)
if (this.state.show && !nextProps.safari && nextProps.videoURL && nextProps.videoURL !== this.props.videoURL) {
setTimeout(function () {
this.player.reset();
this.player.attachView(this.video);
this.player.attachSource(nextProps.videoURL);
this.setState({ volume: this.player.getVolume() });
}.bind(this), 2000)
}
}
This looks like a bug (or at least a deficiency with the documentation) with dash.js - you should open a new issue at https://github.com/Dash-Industry-Forum/dash.js/issues.EDIT: This has been fixed as of dash.js v2.8.0.
In the meantime, for your use case where it looks like
this.video
doesn't change between calls, you can probably remove the calls toreset
andattachView
and just callattachSource
with the newnextProps.videoURL
. Note that you would obviously still need to callattachView
(orinitialize
) at least once to attachthis.video
.