Skip to content

Commit

Permalink
Merge pull request #943 from prebid/fix/instream-test-case
Browse files Browse the repository at this point in the history
In-stream video examples migration
  • Loading branch information
jsligh authored Jan 4, 2024
2 parents 5ac46d1 + 524360d commit 0949615
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
@import PrebidMobile;

NSString * const videoContentURL = @"https://storage.googleapis.com/gvabox/media/samples/stock.mp4";
NSString * const storedImpVideo = @"prebid-demo-video-interstitial-320-480";
NSString * const gamAdUnitVideo = @"/21808260008/prebid_oxb_interstitial_video";
NSString * const storedImpVideo = @"prebid-demo-video-interstitial-320-480-original-api";
NSString * const gamAdUnitVideo = @"/21808260008/prebid_demo_app_instream";

@interface GAMOriginalAPIVideoInstreamViewController ()

Expand Down Expand Up @@ -90,7 +90,7 @@ - (void)onPlayButtonPressed:(id)sender {

- (void)createAd {
// 1. Create InstreamVideoAdUnit
self.adUnit = [[InstreamVideoAdUnit alloc] initWithConfigId:storedImpVideo size:self.adSize];
self.adUnit = [[InstreamVideoAdUnit alloc] initWithConfigId:storedImpVideo size:CGSizeMake(640, 480)];

// 2. Configure Video Parameters
VideoParameters * parameters = [[VideoParameters alloc] initWithMimes:@[@"video/mp4"]];
Expand All @@ -112,7 +112,7 @@ - (void)createAd {
@try
{
// 5. Generate GAM Instream URI
NSString * adServerTag = [IMAUtils.shared generateInstreamUriForGAMWithAdUnitID:gamAdUnitVideo adSlotSizes:@[IMAAdSlotSize.Size320x480] customKeywords:prebidKeys error:nil];
NSString * adServerTag = [IMAUtils.shared generateInstreamUriForGAMWithAdUnitID:gamAdUnitVideo adSlotSizes:@[IMAAdSlotSize.Size640x480] customKeywords:prebidKeys error:nil];

// 6. Load IMA ad request
IMAAdDisplayContainer * adDisplayContainer = [[IMAAdDisplayContainer alloc] initWithAdContainer:self.instreamView viewController:self];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import PrebidMobile
import GoogleInteractiveMediaAds

fileprivate let videoContentURL = "https://storage.googleapis.com/gvabox/media/samples/stock.mp4"
fileprivate let storedImpVideo = "prebid-demo-video-interstitial-320-480"
fileprivate let gamAdUnitVideo = "/21808260008/prebid_oxb_interstitial_video"
fileprivate let storedImpVideo = "prebid-demo-video-interstitial-320-480-original-api"
fileprivate let gamAdUnitVideo = "/21808260008/prebid_demo_app_instream"

class GAMOriginalAPIVideoInstreamViewController:
InstreamBaseViewController,
Expand Down Expand Up @@ -89,7 +89,7 @@ class GAMOriginalAPIVideoInstreamViewController:

func createAd() {
// 1. Create InstreamVideoAdUnit
adUnit = InstreamVideoAdUnit(configId: storedImpVideo, size: CGSize(width: 1,height: 1))
adUnit = InstreamVideoAdUnit(configId: storedImpVideo, size: CGSize(width: 640, height: 480))

// 2. Configure Video Parameters
let parameters = VideoParameters(mimes: ["video/mp4"])
Expand All @@ -108,7 +108,7 @@ class GAMOriginalAPIVideoInstreamViewController:
do {

// 5. Generate GAM Instream URI
let adServerTag = try IMAUtils.shared.generateInstreamUriForGAM(adUnitID: gamAdUnitVideo, adSlotSizes: [.Size320x480], customKeywords: prebidKeys!)
let adServerTag = try IMAUtils.shared.generateInstreamUriForGAM(adUnitID: gamAdUnitVideo, adSlotSizes: [.Size640x480], customKeywords: prebidKeys!)

// 6. Load IMA ad request
let adDisplayContainer = IMAAdDisplayContainer(adContainer: self.instreamView, viewController: self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ struct TestCaseManager {

let instreamController = PrebidOriginalAPIVideoInstreamViewController(rootController: adapterVC)
instreamController.videoContentURL = "https://storage.googleapis.com/gvabox/media/samples/stock.mp4"
instreamController.prebidConfigId = "prebid-ita-video-interstitial-320-480"
instreamController.gamAdUnitVideo = "/21808260008/prebid_oxb_interstitial_video"
instreamController.prebidConfigId = "prebid-demo-video-interstitial-320-480-original-api"
instreamController.gamAdUnitVideo = "/21808260008/prebid_demo_app_instream"

adapterVC.setup(adapter: instreamController)
setupCustomParams(for: instreamController.prebidConfigId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class PrebidOriginalAPIVideoInstreamViewController:
name: NSNotification.Name.AVPlayerItemDidPlayToEndTime,
object: contentPlayer?.currentItem)

adUnit = VideoAdUnit(configId: prebidConfigId, size: CGSize(width: 1, height: 1))
adUnit = VideoAdUnit(configId: prebidConfigId, size: CGSize(width: 640, height: 480))

// imp[].ext.data
if let adUnitContext = AppConfiguration.shared.adUnitContext {
Expand Down Expand Up @@ -158,7 +158,7 @@ class PrebidOriginalAPIVideoInstreamViewController:
guard let self = self else { return }
if resultCode == .prebidDemandFetchSuccess {
do {
let adServerTag = try IMAUtils.shared.generateInstreamUriForGAM(adUnitID: self.gamAdUnitVideo, adSlotSizes: [.Size320x480], customKeywords: prebidKeys!)
let adServerTag = try IMAUtils.shared.generateInstreamUriForGAM(adUnitID: self.gamAdUnitVideo, adSlotSizes: [.Size640x480], customKeywords: prebidKeys!)

let adDisplayContainer = IMAAdDisplayContainer(adContainer: self.rootController.bannerView, viewController: self.rootController)
let request = IMAAdsRequest(adTagUrl: adServerTag, adDisplayContainer: adDisplayContainer, contentPlayhead: nil, userContext: nil)
Expand Down

0 comments on commit 0949615

Please sign in to comment.