这是indexloc提供的服务,不要输入任何密码
Skip to content

Player Errors during Ad playback not are attributed correctly #2656

@stevemayhew

Description

@stevemayhew

Version

Media3 main branch

More version details

commit ec6ac47 (upstream/main, stevem/main, stevem/HEAD, main)
Author: tianyifeng tianyifeng@google.com
Date: Tue Jul 22 10:43:21 2025 -0700

Devices that reproduce the issue

I reproduced on an SEI AmLogic Android TV device, however most any device should see the same issue.

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

Play the sample media.exolist.json items I will email to the developers. The use cases are, pre-roll ad with:

  1. Content that fails immediately after preparation (missing DRM key is an easy one)
  2. Stock android video in the examples, with an VAST tag containing an ad that fails during playback (easy way is a 404 on a segment). Either single ad or one of a pod.

Expected result

  • Content errors should not affect ad playback.
  • Ads should be allowed to complete cleanly if they are functioning.
  • A single failed ad in a pod should be skipped.
  • If an ad fails, playback should fall back to content.

Actual result

  • Ads that were playing successfully are incorrectly marked as failed (AD_STATE_ERROR)
  • Ads are never finalized as completed (remain in AD_STATE_PAUSED)
  • A failed ad is not skipped within a pod
  • Failed ads do not fall back to content playback

Detailed Description

The change introduced in commit 7cf2fd9 attempted to fix premature error dispatch during ad playback by delaying onPlayerError() handling until after the Listner.onEvents() cycle completed.

When an error occurs during content preparation while an ad is still playing, ExoPlayer cannot correctly attribute the error to the content source. Instead, the error bubbles up through ExoPlayerImplInternal.stopInternal() and causes the entire CompositeMediaSource (AdsMediaSource + content) to be torn down.

This results in the ImaAdsLoader being stopped prematurely — even when the ad is not at fault — and breaks proper ad lifecycle handling.

User-Facing Issues

  1. The ad is incorrectly marked as failed
    A content preparation error is misattributed to the currently playing ad, resulting in an invalid AD_STATE_ERROR.
  2. The ad is never marked as completed
    Even though ALL_ADS_COMPLETED is dispatched by IMA, the player is torn down before ExoPlayer updates AdPlaybackState to reflect completion.
  3. A single failing ad in a pod is not skipped
    If one ad in a pod fails (e.g., due to a 404 or DRM error), the player stops entirely instead of skipping to the next ad in the group.
  4. A failing ad does not fall back to content
    When an ad fails, the player should skip to content. Instead, the entire playback pipeline is torn down via stopInternal().

Media

Either construct yourself with the guidance above or look to the info email I will send,

Bug Report

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