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()));
}
}
Aggregations