Update principle of video.buffered.start in sourcebuffer.onupdateend callback

When using HTML5the video player, bufferedthe property is used to get the extent of the video buffer, and the event SourceBufferof onupdateendis used to notify the client that new video data has been added to the buffer. The property's value changes when onupdateendthe event is fired and new video data is added to the buffer .buffered

In the callback function of this event, the time range of the current buffer of the video can be obtained through the and values buffered​​of the property . The value of represents the start time of the buffer, and the value of represents the end time of the buffer. Both values ​​are in seconds.startendstartend

As new video data is added to the buffer, bufferedthe extent of the is expanded to include the newly added video data. SourceBuffer.appendBuffer()Specifically, after data is added to the buffer using onupdateendthe event will be fired and the value of buffered.end will be updated with the end time of all data in the buffer.

After bufferedthe value changes, the video player can use these values ​​to determine the playable video segment and buffer size to optimize the player's performance and user experience.

It is important to note that as video data is dynamically added to the buffer, bufferedthe value may change over time. Therefore, during player implementation, these values ​​should be used to dynamically update progress bars and other UI elements to reflect the current buffering status of the video in a timely manner.

Guess you like

Origin blog.csdn.net/klylove/article/details/131247024