Search in sources :

Example 1 with RewardedVideoCreative

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

the class CreativeFactory method attemptVastCreative.

private void attemptVastCreative() {
    VideoCreativeModel videoCreativeModel = (VideoCreativeModel) mCreativeModel;
    String mediaUrl = videoCreativeModel.getMediaUrl();
    if (Utils.isBlank(mediaUrl) || mediaUrl.equals("invalid media file")) {
        mListener.onFailure(new AdException(AdException.INTERNAL_ERROR, VASTErrorCodes.NO_SUPPORTED_MEDIA_ERROR.toString()));
        return;
    }
    // get the tracking url for all event types & do the registration here.
    for (VideoAdEvent.Event videoEvent : VideoAdEvent.Event.values()) {
        videoCreativeModel.registerVideoEvent(videoEvent, videoCreativeModel.getVideoEventUrls().get(videoEvent));
    }
    VideoCreative newCreative;
    try {
        if (mCreativeModel.getAdConfiguration().isRewarded()) {
            newCreative = new RewardedVideoCreative(mContextReference.get(), videoCreativeModel, mOmAdSessionManager, mInterstitialManager);
        } else {
            newCreative = new VideoCreative(mContextReference.get(), videoCreativeModel, mOmAdSessionManager, mInterstitialManager);
        }
        newCreative.setResolutionListener(new CreativeFactoryCreativeResolutionListener(this));
        mCreative = newCreative;
        markWorkStart(VAST_TIMEOUT);
        newCreative.load();
    } catch (Exception exception) {
        LogUtil.error(TAG, "VideoCreative creation failed: " + Log.getStackTraceString(exception));
        mListener.onFailure(new AdException(AdException.INTERNAL_ERROR, "VideoCreative creation failed: " + exception.getMessage()));
    }
}
Also used : RewardedVideoCreative(org.prebid.mobile.rendering.video.RewardedVideoCreative) VideoCreative(org.prebid.mobile.rendering.video.VideoCreative) RewardedVideoCreative(org.prebid.mobile.rendering.video.RewardedVideoCreative) VideoAdEvent(org.prebid.mobile.rendering.video.VideoAdEvent) AdException(org.prebid.mobile.rendering.errors.AdException) VideoCreativeModel(org.prebid.mobile.rendering.video.VideoCreativeModel) AdException(org.prebid.mobile.rendering.errors.AdException)

Aggregations

AdException (org.prebid.mobile.rendering.errors.AdException)1 RewardedVideoCreative (org.prebid.mobile.rendering.video.RewardedVideoCreative)1 VideoAdEvent (org.prebid.mobile.rendering.video.VideoAdEvent)1 VideoCreative (org.prebid.mobile.rendering.video.VideoCreative)1 VideoCreativeModel (org.prebid.mobile.rendering.video.VideoCreativeModel)1