Search in sources :

Example 1 with Video

use of org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video in project prebid-mobile-android by prebid.

the class BasicParameterBuilderTest method getExpectedVideoImpValues.

private Video getExpectedVideoImpValues(Imp imp, AdConfiguration adConfiguration) {
    Video video = new Video();
    // Common values for all video reqs
    video.mimes = BasicParameterBuilder.SUPPORTED_VIDEO_MIME_TYPES;
    video.protocols = BasicParameterBuilder.SUPPORTED_VIDEO_PROTOCOLS;
    video.linearity = BasicParameterBuilder.VIDEO_LINEARITY_LINEAR;
    // Interstitial video specific values
    // On Leaving Viewport or when Terminated by User
    video.playbackend = VIDEO_INTERSTITIAL_PLAYBACK_END;
    video.delivery = new int[] { BasicParameterBuilder.VIDEO_DELIVERY_DOWNLOAD };
    video.pos = AdPosition.FULLSCREEN.getValue();
    if (!adConfiguration.isPlacementTypeValid()) {
        video.placement = VIDEO_INTERSTITIAL_PLACEMENT;
        Configuration deviceConfiguration = mContext.getResources().getConfiguration();
        video.w = deviceConfiguration.screenWidthDp;
        video.h = deviceConfiguration.screenHeightDp;
    } else {
        video.placement = adConfiguration.getPlacementTypeValue();
        for (AdSize size : adConfiguration.getAdSizes()) {
            video.w = size.width;
            video.h = size.height;
            break;
        }
    }
    return video;
}
Also used : Configuration(android.content.res.Configuration) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Video(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video) AdSize(org.prebid.mobile.rendering.bidding.data.AdSize)

Example 2 with Video

use of org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video in project prebid-mobile-android by prebid.

the class ImpTest method getJsonObject.

@Test
public void getJsonObject() throws Exception {
    Imp imp = new Imp();
    imp.displaymanager = "prebid";
    imp.displaymanagerver = "1.0";
    imp.instl = 1;
    imp.tagid = "tagid";
    imp.secure = 0;
    imp.banner = new Banner();
    imp.video = new Video();
    imp.pmp = new Pmp();
    imp.clickBrowser = 0;
    JSONObject actualObj = imp.getJsonObject();
    String expectedString = "{\"clickbrowser\":0,\"pmp\":{},\"tagid\":\"tagid\",\"displaymanager\":\"prebid\",\"displaymanagerver\":\"1.0\",\"banner\":{},\"video\":{},\"secure\":0,\"instl\":1}";
    assertEquals("got: " + actualObj.toString(), expectedString, actualObj.toString());
    imp.getJsonObject();
}
Also used : Pmp(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Pmp) JSONObject(org.json.JSONObject) Banner(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Banner) Video(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video) Test(org.junit.Test)

Example 3 with Video

use of org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video in project prebid-mobile-android by prebid.

the class BasicParameterBuilder method setVideoImpValues.

private void setVideoImpValues(Imp imp) {
    Video video = new Video();
    // Common values for all video reqs
    video.mimes = SUPPORTED_VIDEO_MIME_TYPES;
    video.protocols = SUPPORTED_VIDEO_PROTOCOLS;
    video.linearity = VIDEO_LINEARITY_LINEAR;
    // Interstitial video specific values
    // On Leaving Viewport or when Terminated by User
    video.playbackend = VIDEO_INTERSTITIAL_PLAYBACK_END;
    video.delivery = new int[] { VIDEO_DELIVERY_DOWNLOAD };
    if (mAdConfiguration.isAdPositionValid()) {
        video.pos = mAdConfiguration.getAdPositionValue();
    }
    if (!mAdConfiguration.isPlacementTypeValid()) {
        video.placement = PlacementType.INTERSTITIAL.getValue();
        if (mResources != null) {
            Configuration deviceConfiguration = mResources.getConfiguration();
            video.w = deviceConfiguration.screenWidthDp;
            video.h = deviceConfiguration.screenHeightDp;
        }
    } else {
        video.placement = mAdConfiguration.getPlacementTypeValue();
        for (AdSize size : mAdConfiguration.getAdSizes()) {
            video.w = size.width;
            video.h = size.height;
            break;
        }
    }
    imp.video = video;
}
Also used : Configuration(android.content.res.Configuration) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Video(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video) AdSize(org.prebid.mobile.rendering.bidding.data.AdSize)

Aggregations

Video (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video)3 Configuration (android.content.res.Configuration)2 AdSize (org.prebid.mobile.rendering.bidding.data.AdSize)2 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)2 JSONObject (org.json.JSONObject)1 Test (org.junit.Test)1 Banner (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Banner)1 Pmp (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Pmp)1