【问题标题】:React js switch video sources error comes in Dash.jsDash.js 中出现 React js 切换视频源错误
【发布时间】:2018-07-05 14:54:10
【问题描述】:

我正在使用 dashjs 开发 reactjs 项目,用于播放视频文件。当我在 attachView() 函数中切换视频时出现以下错误。

console click here for more details 我正在使用以下代码: 组件WillReceiveProps(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)

}

}

【问题讨论】:

  • 如果您有办法将您在问题中看到的错误以文本形式分享给edit

标签: reactjs mp4 wowza dash.js


【解决方案1】:

这看起来像是 dash.js 的一个错误(或至少是文档的缺陷) - 您应该在 https://github.com/Dash-Industry-Forum/dash.js/issues 上打开一个新问题。

编辑:从 dash.js v2.8.0 开始,此问题已得到修复。

同时,对于您的用例,在调用之间看起来 this.video 没有变化,您可能可以删除对 resetattachView 的调用,然后使用新的 attachSource 调用 @987654327 @。请注意,您显然仍需要至少调用一次attachView(或initialize)才能附加this.video

【讨论】:

猜你喜欢
  • 2014-12-09
  • 1970-01-01
  • 2021-11-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-11-19
  • 2020-12-18
  • 1970-01-01
相关资源
最近更新 更多