Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use IMA extension with Leanback on Android TV? #10736

Closed
pastafarianGit opened this issue Nov 1, 2022 · 2 comments
Closed

How to use IMA extension with Leanback on Android TV? #10736

pastafarianGit opened this issue Nov 1, 2022 · 2 comments
Assignees
Labels

Comments

@pastafarianGit
Copy link

I am trying to add local ads implementation with leanback exoplayer.
I am following https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side

But I am unsure on what to set adViewProvider since I am using PlaybackTransportControlGlue and not player view.
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/source/DefaultMediaSourceFactory.html#setLocalAdInsertionComponents(com.google.android.exoplayer2.source.ads.AdsLoader.Provider,com.google.android.exoplayer2.ui.AdViewProvider)

Any tips will be really appreciated.

@marcbaechinger
Copy link
Contributor

If you are not using PlayerView then your app UI needs to provide an ViewGroup rather than using the player view. The ViewGroup needs to be an overlay of the surface that plays the ad, so that the ad SDK can insert UI elements that appear on top of the ad while the ad is playing (like the skip button or the more info link and the like). Add such a ViewGroup to your UI and pass it as return value of the AdViewProvider.getAdViewGroup().

@pastafarianGit
Copy link
Author

jup that was it. Thanks alot for help ! You are my hero. <3
I just implemented AdViewProvider on my VideoSupportFragment and it worked.

public class PlayerFragment extends VideoSupportFragment implements AdViewProvider{
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mPlayerView = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState);
        }
        
    @Override
    public ViewGroup getAdViewGroup() {
        return mPlayerView;
    }
}

@marcbaechinger marcbaechinger changed the title how to use IMA sdk with Leanback on android tv? How to use IMA extension with Leanback on Android TV? Nov 2, 2022
@google google locked and limited conversation to collaborators Jan 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants