视频直播点播平台EasyDSS集成H.265报style of null 错误如何解决?

青犀团队研发的视频直播点播流媒体平台EasyDSS支持H.265视频编码的播放,为此我们花了很大的精力在这上面,在研发过程中,我们碰见了报错问题:集成H265报style of null 错误。下面我们就来讲一下关于这个报错,我们是如何解决的。

EasyDSS集成H265报错的内容为:
(TypeError: Cannot set property ‘style’ of null)

960.png

分析问题

错误报的是样式无法找到,在测试的时候只要id为动态绑定就会出现。那就是可能绑定数据还没加载,div就已经加载。导致出现style of null。

<div :id="PlayerName"></div>
  <div id="test"></div>

解决问题

1.在实例化播放器加个延时;

  created() {
    setTimeout(() => {
      new WasmPlayer('', this.PlayerName);
    }, 300);
  }

2.放在生命周期的mounted(DOM加载完成执行) 函数里。

mounted() {
   new WasmPlayer('', this.PlayerName);
}

EasyDSS正常播放H.265编码视频的界面:

DSS7.png

猜你喜欢

转载自blog.csdn.net/EasyDSS/article/details/107629710