MoePlayer/react-dplayer

异步加载Url时,视频无法播放,src 并没有赋值,有相关事件吗

itshizhan opened this issue · 1 comments

<DPlayer video={{url: videoUrl}} />

当url 异步加载时,视频地址无法加载。看源码里面好像并没有 对 componentWillReceiveProps getDerivedStateFromProps 周期进行处理。 有其他事件进行处理吗

暂时并没有对ReceiveProps 进行 视频地址切换
可以自行进行二次封装处理

 componentWillReceiveProps(nextProps) {
    if(this.dp && (nextProps.video.type !== this.props.video.type || nextProps.video.url !== this.props.video.url)){
          this.dp.switchVideo({
            url: nextProps.video.url,
          })
        })
    }
  }