Search in sources :

Example 1 with ExoPlayerView

use of org.prebid.mobile.rendering.video.ExoPlayerView in project prebid-mobile-android by prebid.

the class ViewPool method getUnoccupiedView.

// Q: why are we keeping it in occupied? Should we not put/get from unoccupied directly?
// A: Because, when a videoCreativeView is created, we will have to, anyways, add the view to the occupied bucket as it is going to be given to adView.
// So, do that step here itself.(distribution of work!)
public View getUnoccupiedView(Context context, VideoCreativeViewListener videoCreativeViewListener, AdConfiguration.AdUnitIdentifierType adType, InterstitialManager interstitialManager) throws AdException {
    if (context == null) {
        throw new AdException(AdException.INTERNAL_ERROR, "Context is null");
    }
    if (mUnoccupiedViews != null && mUnoccupiedViews.size() > 0) {
        View view = mUnoccupiedViews.get(0);
        Views.removeFromParent(view);
        // get item from unoccupied & add it to occupied
        swapToOccupied(view);
        return mOccupiedViews.get(mOccupiedViews.size() - 1);
    }
    switch(adType) {
        case BANNER:
            plugPlayView = new PrebidWebViewBanner(context, interstitialManager);
            break;
        case INTERSTITIAL:
            plugPlayView = new PrebidWebViewInterstitial(context, interstitialManager);
            // add it to occupied
            break;
        case VAST:
            plugPlayView = new ExoPlayerView(context, videoCreativeViewListener);
            break;
    }
    addToOccupied(plugPlayView);
    return plugPlayView;
}
Also used : PrebidWebViewInterstitial(org.prebid.mobile.rendering.views.webview.PrebidWebViewInterstitial) PrebidWebViewBanner(org.prebid.mobile.rendering.views.webview.PrebidWebViewBanner) ExoPlayerView(org.prebid.mobile.rendering.video.ExoPlayerView) View(android.view.View) ExoPlayerView(org.prebid.mobile.rendering.video.ExoPlayerView) AdException(org.prebid.mobile.rendering.errors.AdException)

Aggregations

View (android.view.View)1 AdException (org.prebid.mobile.rendering.errors.AdException)1 ExoPlayerView (org.prebid.mobile.rendering.video.ExoPlayerView)1 PrebidWebViewBanner (org.prebid.mobile.rendering.views.webview.PrebidWebViewBanner)1 PrebidWebViewInterstitial (org.prebid.mobile.rendering.views.webview.PrebidWebViewInterstitial)1