androidx / androidx/media

AdsMediaSource with HLS content fails on progressive (MP4) ads with HlsPlaylistParser$ParserException

Open
#2,698 3 comments 0 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Aug 6, 2025.

bug
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

Media3 main branch

More version details

androidx.media3:media3-exoplayer:1.5.1

Devices that reproduce the issue
  • Samsung A54
  • Vivo V2434
  • Emulator Pixel 7 OS 14
Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps
  1. Set up an ExoPlayer instance to play a live or VOD HLS stream.
  2. Use the ImaAdsLoader for client-side ad insertion.
  3. Configure a MediaItem with a VMAP ad tag URI using MediaItem.Builder().setAdsConfiguration(...).
  4. Ensure the VMAP points to a VAST response where at least one of the ad creatives is a progressive MP4 file (not an HLS .m3u8 playlist).
  5. Prepare and play the MediaItem.
  6. The player will attempt to load the pre-roll ad, select the MP4 media, and crash with the HlsPlaylistParser exception.
Expected result

The player should seamlessly play the MP4 ad and then return to the HLS content

Actual result

When playing HLS main content and using client-side ad insertion with a VMAP ad tag, the player crashes if an ad creative in the VAST response is a progressive MP4 file instead of an HLS playlist. The crash occurs because the player attempts to parse the MP4 ad media using the HlsPlaylistParser, which was configured for the main content.

This leads to the following fatal exception:
androidx.media3.exoplayer.source.ads.AdsMediaSource$AdLoadException: androidx.media3.common.ParserException: Input does not start with the #EXTM3U header.{contentIsMalformed=true, dataType=4} at androidx.media3.exoplayer.source.ads.AdsMediaSource$AdPrepareListener.onPrepareError(AdsMediaSource.java:459) at androidx.media3.exoplayer.source.MaskingMediaPeriod.maybeThrowPrepareError(MaskingMediaPeriod.java:167) at androidx.media3.exoplayer.source.MaskingMediaPeriod.maybeThrowPrepareError(MaskingMediaPeriod.java:157) at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1129) at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:544) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loopOnce(Looper.java:250) at android.os.Looper.loop(Looper.java:340) at android.os.HandlerThread.run(HandlerThread.java:107) Caused by: androidx.media3.common.ParserException: Input does not start with the #EXTM3U header.{contentIsMalformed=true, dataType=4} at androidx.media3.exoplayer.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:262) at androidx.media3.exoplayer.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:69) at androidx.media3.exoplayer.upstream.ParsingLoadable.load(ParsingLoadable.java:184) at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:421) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012) ]

Media

Vast tag https://dev-ads.rctiplus.com/ads/v1/vmap?adspreset_id=38&channel_id=1&ima=0&platform=web&program_title=Iiihh_Serrreemm&vtype=live&vid_t=RCTI

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.