bilibili / flv.js

HTML5 FLV Player
Apache License 2.0
22.91k stars 3.39k forks source link

Uncaught TypeError: Cannot read property 'flushStashedSamples' of null #661

Open caobaojin opened 3 years ago

caobaojin commented 3 years ago

When the FFmpeg push stream is abnormal, the client reports an ERROR: the attribute "FlushstashedSamples" cannot be found, and the ERROR event is not triggered

eilskn commented 3 years ago

Any can help?

twilson90 commented 2 years ago

Same issue. Anyone solved this?

970655147 commented 2 years ago

the best way is fix this problem at flvjs if you can't update flvjs, you might update as follow, to skip this temporaryly

// step1. add deferLoadAfterSourceOpen's config while createPlayer

this.player = flvjs.createPlayer({ type: "flv", isLive: true, url: "ws://localhost:9999/rtsp/xxx?url=rtsp://localhost:8554/rtsp/test_rtsp" }, { deferLoadAfterSourceOpen: false });

// step2. add following code after this.player.load()

let controller = this.player._transmuxer._controller let wsLoader = controller._ioctl._loader var oldWsOnCompleteFunc = wsLoader._onComplete wsLoader._onComplete = function() { if(!controller._remuxer) { controller._remuxer = { flushStashedSamples: function () { _this.loadingVisiable = false console.log("flushStashedSamples") } } } oldWsOnCompleteFunc() }