flv.js 错误,"This SourceBuffer has been removed from the parent media source" 正在调试

flv.js error, "This SourceBuffer has been removed from the parent media source" debugging

我正在尝试调试来自监控摄像头的 streaming/viewing 视频内容的问题。这是一个仅出现在特定环境 (NWJS) 中的问题,但不会出现在其他环境中(Chrome、Firefox。)但请注意,NWJS 使用 Chrome 浏览器引擎呈现内容。

在出现问题的环境下,视频没有流式传输,即黑屏。我还在快速循环中重复出现以下错误:

"Uncaught (in promise) InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer': This SourceBuffer has been removed from the parent media source."

这是打印出来的logging/error。括号内的行由 flv.js 文件生成,出现时显示更新状态。 (我不知道 SetApplicationIsDaemon 错误是否与此有关。):

"[MSEController] > MediaSource onSourceOpen"
"[FLVDemuxer] > Parsed onMetaData"
"[FLVDemuxer] > Parsed AVCDecoderConfigurationRecord"
"[MSEController] > Received Initialization Segment, mimeType: video/mp4;codecs=avc1.640033"
"[FLVDemuxer] > Parsed AudioSpecificConfig"
"[MSEController] > Received Initialization Segment, mimeType: audio/mp4;codecs=mp4a.40.5"
SetApplicationIsDaemon: Error Domain=NSOSStatusErrorDomain Code=-50 "paramErr: error in user parameter list" (-50)
"[MSEController] > MediaSource onSourceClose"
"Uncaught (in promise) InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer': This SourceBuffer has been removed from the parent media source."
"Uncaught (in promise) InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer': This SourceBuffer has been removed from the parent media source."
"Uncaught (in promise) InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer': This SourceBuffer has been removed from the parent media source."
ad-infinitum...

在我对该问题的搜索中,我只想到了 MediaSource error: This SourceBuffer has been removed from the parent media source,那里的答案指出该问题与视频编解码器的问题有关。当然,由于是监控摄像头的来源,我无法控制它,而且,正如我所说,它在某些环境下播放效果很好。

我已经尝试覆盖相机代码中使用的 JS 方法,例如,发生错误的方法,以及导致它的调用,以便获得关于错误发生的原因以及如何fix/workaround 它,虽然没有取得太大的成功。

我有一个迹象表明视频可能实际上已加载但未流式传输,因为当我右键单击播放器并单击“媒体信息”时,“速度”值不断变化,但没有其他值。 Chrome 浏览器中的信息 window(视频在其中运行良好)将显示逐渐增加的解码、当前时间、bufstart 和 bufended 值。 (随附的屏幕截图显示了我所指的信息 window。)而且它似乎加载了一些东西,否则我会得到一个旋转的“加载”指示器,或者它最终会显示一条消息,“流无法被发现。"

奇怪的是,page/camera 有一个“回放”模式,可以播放记录在相机 SD 卡上的视频,而且播放效果很好。

几天来我一直断断续续地研究这个问题,试图操纵代码并在不同的站点和 NWJS github 页面上提问。

没有看到您的任何代码,没有人可以推荐太多。既然你说它看起来 'speed' 不断变化但没有渲染,我猜你缺少该特定流所需的编解码器。 “播放”模式可能使用不同的编码,因此播放没有问题。

要让专有编解码器在 NW.js 中工作,请参阅:https://nwjs.readthedocs.io/en/latest/For%20Developers/Enable%20Proprietary%20Codecs/#enable-proprietary-codecs