Skip to content

Interstitial asset player incorrectly signals "ended" event #7659

@Sigebriht

Description

@Sigebriht

What version of Hls.js are you using?

1.6.14

What browser (including version) are you using?

Chromium Version 142.0.7444.162 (Official Build) stable (64-bit)

What OS (including version) are you using?

Linux OpenSuse Tumbleweed

Test stream

No response

Configuration

const config = {
    debug: true
};

Additional player setup steps

const player = new Hls(config);
player.attachMedia(videoElement);

Checklist

Steps to reproduce

  1. Add an event listener to the video element for "ended", e.g:
    videoElement.addEventListener("ended", (ev) => { console.log("**** ENDED"); });
  2. Play a stream that has HLS Interstitial ads (VOD or live) and wait for a an interstitial break to finish with the stream still playing
  3. Check the log to see whether "ended" has been signalled with the stream still playing

Expected behaviour

ended should not be signalled at the end of an interstitial break if the stream is still playing. Presumably, because the interstitial player is attached to the video element, it signals ended once it has no more data. However, this does not conform to the spec.

The HTML5 spec states that ended should be sent when playback has ended, which is defined as "The current playback position is the end of the media resource":

https://html.spec.whatwg.org/multipage/media.html#ended-playback

Media resource is defined here:

https://www.w3.org/TR/2008/WD-html5-20080610/video.html#:~:text=The%20term%20media%20resource%20is,file%2C%20or%20complete%20audio%20file.

"The term media resource is used to refer to the complete set of media data, e.g. the complete video file, or complete audio file"

An interstitial ad break does not meet the definition of a media resource.

What actually happened?

The ended event gets called after the interstitial break when the stream is still playing.

Console output

Not applicable.

Chrome media internals output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions