【问题标题】:MSE WebM finishing before duration with no end eventMSE WebM 在没有结束事件的持续时间之前完成
【发布时间】:2021-06-26 02:58:34
【问题描述】:

媒体源扩展中的 WebM 有一个奇怪的问题。

视频时长(根据videoEl.duration)为8.354999999999999。

视频到达当前时间 = 8.328015 并停止,没有触发任何事件。

MediaSource 持续时间为 8.403,我可以看到,当它完成时没有触发任何事件。

我找不到视频文件有任何问题。我的代码是相当标准的附加到缓冲区,它可以与其他 WebM 一起使用。

这是我的代码(在 Redux Saga 中)

while(chunks.length && !complete){
        const event = yield take(sourceBufferEvents)
        console.log(event)
        if(event.type === "updateend"){
            if(loading){
                yield fork(loaded, true)

                while(loading){
                    const event = yield take(videoEvents)

                    if(chunks && event.type === "playing"){
                        loading = false
                        yield fetchNextSegment(asset.id, asset.remoteUrl, sourceBuffer,  chunks.shift())
                        videoEvents.close()
                    }
                }
            }
            else {
                yield fetchNextSegment(asset.id, asset.remoteUrl, sourceBuffer, chunks.shift() ) 
                index ++;
            }    
        }
       
        if(total === index){
            // yield mediaSource.endOfStream()
            // complete = true
            while(sourceBuffer.updating){
                console.log(total, index)
            }
            console.log(sourceBuffer.updating)
           
        }
    }

这些事件在 updateEnd 时被调用。

sourceBuffer.updating 永远不会错误

我收到DOMException: Failed to execute 'endOfStream' on 'MediaSource': The 'updating' attribute is true on one or more of this MediaSource's SourceBuffers.

当我尝试结束直播时

【问题讨论】:

  • 显示你的代码,你调用 endOfStream() 吗?
  • @beek “我的代码可以与其他 WebM 一起使用...我找不到视频文件有任何问题。” 如果其他文件可以正常工作,那么我仍然会怀疑某些问题那个特定的 webM 是错误的。如果重新编码文件会发生什么?各种媒体播放器是否都提供一致的持续时间(例如: 浏览器时间 vs VLC 时间 vs FFplay 时间)?
  • @Kaiido 不,我没有。会看的谢谢。

标签: javascript html5-video webm media-source


【解决方案1】:

根据 Kaiido 的评论,我不得不使用 endOfStream 并且我错过了最终的 updateended 事件。

【讨论】:

  • 有趣,那么如果您从未使用过 endOfStream,它是如何“与其他 webM 一起正常工作”的?它们是持续时间短的文件(秒)还是这样的?只是想知道这个怪癖在某些情况下是否有用......
  • 估计的持续时间可能与实际持续时间足够接近?不确定。
猜你喜欢
  • 1970-01-01
  • 2015-03-13
  • 2020-06-23
  • 2017-12-14
  • 1970-01-01
  • 2018-08-05
  • 2021-10-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多