Skip to content

How to play video with HLS interstitials from a specified position after ads? #2558

Closed

Description

@aaxb

If set a seek time for the video(with HLS interstitials) to start playing from a specified position
a. seek positio is after any ad position, the screen is black and not show ad or media contents.
b. seek position is before the ads, the player can work well.

Exoplayer version: 1.8.0-alpha01
Steps:
Set HlsInterstitialsAdsLoader as https://developer.android.com/media/media3/exoplayer/hls#interstitials

player.setMediaItem(
    new MediaItem.Builder()
        .setUri("https://www.example.com/media.m3u8")
        .setAdsConfiguration(
            new AdsConfiguration.Builder(Uri.parse("hls://interstitials"))
                .setAdsId("ad-tag-0") // must be unique within playlist
                .build())
        .build());
player.seekTo(seekPosition); //just add this line for start position
player.prepare();
player.play();

Is this an issue or how to play video with HLS interstitials from a specified position after ads?

Activity

  1. marcbaechinger commented on Jul 1, 2025

    @marcbaechinger
    Contributor

    Thanks for your report!

    That's a bug in HlsInterstitialsAdsLoader. I can repro this with a unit tests and a sample stream with the player when using asset lists. We'll provide a fix for this.

    When the timeline is updated and the position is before a mid roll, the content position needs to be resolved for an ad start position before being used to select the next asset list to be fetched. This way, the initial selection when joining the stream is behaving as for a seek, which is the correct behavior for VOD and live.

  2. marcbaechinger commented on Jul 2, 2025

    @marcbaechinger
    Contributor

    The commit above fixes this problem. Will be included in the next release snapshot.

  3. locked and limited conversation to collaborators on Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions