langhuihui / jessibuca

Jessibuca是一款开源的纯H5直播流播放器
https://jessibuca.com
GNU General Public License v3.0
2.14k stars 401 forks source link

appendBuffer异常 #224

Closed scomouse closed 2 years ago

scomouse commented 2 years ago

mediaSource.addSourceBuffer时出现过2个异常,一个是: Failed to execute 'appendBuffer' on 'SourceBuffer': The HTMLMediaElement.error attribute is not null 导致播放无法正常进行,自动重试一直报错,也无法恢复播放

另一个是The MediaSource's readyState is not 'open'. 这个错误没搞清楚原因,但是我在addSourceBuffer前加上了判断就好了: if(!this.isStateOpen) return ;

bosscheng commented 2 years ago

有测试源码?如果能必先的话,就给我一个测试看下。

scomouse commented 2 years ago

没有,我们是直接接的国标视频流的服务,就是交通摄像头的数据,这些设备可能就不那么稳定,有的画面都在抖动,怀疑是数据包有问题引发的,没法给你测试数据。 还有我想建议的是,类似这种问题,您的组件在处理中能更多考虑下出错处理,我现在是对this.sourceBuffer.appendBuffer(buffer);加了try并emit一个mseSourceBufferError然后在出错时重新播放解决的,效果没那么好。 非常感谢您的回复,以及您提供的组件

bosscheng commented 2 years ago

好的,我自己测试看下。

bosscheng commented 2 years ago

@scomouse 试下最新dist下面的文件看下。

bosscheng commented 2 years ago

‘Failed to execute 'appendBuffer' on 'SourceBuffer': The HTMLMediaElement.error attribute is not null 导致播放无法正常进行,自动重试一直报错,也无法恢复播放’ 这个问题我添加了异常检测,如果检测到了,就会重新触发播放。