SourceBuffer remove() method behaviour

TV model: webOS TV QNED85T6C
webOS TV: webOS24 / 9.1.0-46

We are using Media Source Extensions Web API in order to construct a media stream from a SourceBuffer which is being fed by chunks of downloaded video files via its “appendBuffer()” method. This media stream is connected to the HTML video element in our webOS application in order to play the constructed video. As a reaction to the user pressing the button on their remote controller, we need to flush the already buffered data from the SourceBuffer object using its “remove()” method and start to substitute it with a different data.

We have encountered the following issue in our webOS application - even after the “remove()” method is called and the SourceBuffer reports that the data is removed (“buffered” property of SourceBuffer object: SourceBuffer: buffered property - Web APIs | MDN), the LG TV continues to play the video for a couple of seconds. It would seem that the underlying webOS media player is too eager to consume the data from the SourceBuffer and/or doesn’t respond correctly to the removing of the data from the SourceBuffer.

Is there any way how to:

  • Obtain the information about the buffered data from the underlying Media Player?
  • Configure the size of the buffered data for the media player from within the webOS application?
  • Or is there any way how to force the underlying media player to flush its current buffer?

Another problem we have encountered is a possible bug with the requestVideoFrameCallback() which is mentioned in the separate thread on this forum.

Both these issues are showcased in the sample webOS application. Its source code is very simple and can be run in an ordinary browser to compare the different behaviors on desktop browsers and on an LG TV.
On the LG TV, the application can be controlled by the remote controller buttons:
ENTER: Play the video
Red button: Clear the Source buffer
Green button: Restart the test

The information on the screen shows the actual time ranges within the SourceBuffer and the current timestamp of the video. Notice, that after the buffer is cleared (it is hardcoded to flush from the current timestamp + 2 seconds till the end), the video on LG TV stops on the timestamp which is about 3 seconds AFTER the end of the cleared video (at least on our LG TV model - for different TVs, the time can differ).

Sorry for the late reply. For security reasons, access to Google Drive is not allowed here. Please send the sample app file at developer@lge.com. Thank you.

Thank you for sharing. The webOS TV low level media framework has a queue, and the length of data passed depends on the webOS version. Even if you delete the buffer at a high level, data already passed to the driver or low level will be played before it is changed. If you want to change it immediately, please try seek when changing it. Thank you.