AVPlay fails to trigger `onstreamcompleted` on 2024 TVs

We are experiencing a bug on a newer 2024 model TV where the stream would end and not go to the next video. This is happening consistently when we launch the app(so for the first video).

We are using AVplay and have some logic in the onstreamcompleted event that loads the next video. We have found that the event is not being triggered at the end.

We have tried to recreate with some simple code and found the same:

document.addEventListener('DOMContentLoaded', function () {
  //Append the object element to your document
  document.body.appendChild(objElem);
  window.webapis.avplay.open(
    'our video url',
  );
  window.webapis.avplay.setListener({
    oncurrentplaytime(currentTime) {
      console.log(currentTime);
    },
    onstreamcompleted() {
      console.log(
        window.webapis.avplay.getDuration(),
        window.webapis.avplay.getCurrentTime(),
        'duration current time',
      );
      // Handle video completion by calling onEnd callback and updating playback state
      // This ensures consistent handling of video completion across the application
    },
  });

  window.webapis.avplay.setDisplayMethod('PLAYER_DISPLAY_MODE_LETTER_BOX');
  window.webapis.avplay.setDisplayRect(0, 0, 1920, 1080);
  window.webapis.avplay.prepare();
  window.webapis.avplay.play();
});

In the following video we see that only the oncurrentplaytime is being triggered and there is no output for onstreamcompleted at the end of the stream. We even find the the getDuration value is larger than the last value for oncurrentplaytime.

deviceModelId: UCU7000J
deviceOSVersion: "8.0"
userAgent: "T-KSU2ECDEUC-0080-2024.2"

Hi, welcome to the forum. I’ll try to save you some time here :grin: Samsung seems to recommend this for Smart TV questions…

For Smart TV questions, please log in to TV Seller Office: (Seller2.0), go to the 1:1 Q&A section, and ask a question