gpt4 book ai didi

javascript - 为什么在MSE播放前调用 'endOfStream'?

转载 作者:行者123 更新时间:2023-11-29 14:38:43 26 4
gpt4 key购买 nike

在MSE例子中,播放前调用endOfstream

mediaSource.endOfStream();
video.play()

https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/endOfStream

你知道为什么播放前要调用endOfStream吗?我认为“endOfStream”会在发出视频终止信号时调用。

谢谢!

最佳答案

.endOfStream() 显然在问题的 javascript 中用于更新 HTMLMediaElement 之前的 duration媒体播放开始。

2.4.7 End of stream algorithm

NOTE

This allows the duration to properly reflect the end of the appended media segments. For example, if the duration was explicitly set to 10 seconds and only media segments for 0 to 5 seconds were appended before endOfStream() was called, then the duration will get updated to 5 seconds.

关于javascript - 为什么在MSE播放前调用 'endOfStream'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41776280/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com