androidx / androidx/media

Ads Support With New PlayerSurface? (androidx.media3.ui.compose)

Open
#2,799 1 comment 0 reactions 1 assignee View on GitHub

@oceanjules is already working on this.

Since Sep 25, 2025.

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

Description

Hi there - I've searched StackOverflow and other issues in this repo, but don't see any docs or questions pertaining to this.

I am beginning to use your new Compose library with the PlayerSurface and remembered buttons states - they are awesome, thank you for all the hard work.

I would like to use ads with this new approach but am not sure how that would work, or if it's even possible yet:

The Ad Insertion documentation states that you must set up a media source factory configured for ad insertion. But this requires a reference to the AdViewProvider, which I no longer have because I'm passing that responsibility off to Compose to create - my logic code no longer has any reference to the views because of the cool new Compose stuff. I suppose I can create an empty view group in my VM then emit to my Compose view containing the new PlayerSurface and place that on top...but I am wondering if there is a more elegant or preferred way of setting up ads - whether it be a different way of creating the media source factory or, if that stays the same, creating a ViewGroup to work with the new PlayerView.

I suppose I'll tack on a question about a media3.ui.compose Slider state - is that in the works, by any chance? I read that it might be in a forum, I believe.

Thanks for your time.

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.