コード例 #1
0
            public override void processEvent(Event @event)
            {
                // Create a container object for the ads to be presented.
                AdDisplayContainer container = sdkFactory.createAdDisplayContainer();

                container.Player      = outerInstance.googleIMAComponent.VideoAdPlayer;
                container.AdContainer = brightcoveVideoView;

                // Populate the container with the companion ad slots.
                List <CompanionAdSlot> companionAdSlots = new List <CompanionAdSlot>();
                CompanionAdSlot        companionAdSlot  = sdkFactory.createCompanionAdSlot();
                ViewGroup adFrame = (ViewGroup)findViewById(R.id.ad_frame);

                companionAdSlot.Container = adFrame;
                companionAdSlot.setSize(adFrame.Width, adFrame.Height);
                companionAdSlots.Add(companionAdSlot);
                container.CompanionSlots = companionAdSlots;

                // Build the list of ads request objects, one per ad
                // URL, and point each to the ad display container
                // created above.
                List <AdsRequest> adsRequests = new List <AdsRequest>(outerInstance.googleAds.Length);

                foreach (string adURL in outerInstance.googleAds)
                {
                    AdsRequest adsRequest = sdkFactory.createAdsRequest();
                    adsRequest.AdTagUrl           = adURL;
                    adsRequest.AdDisplayContainer = container;
                    adsRequests.Add(adsRequest);
                }

                // Respond to the event with the new ad requests.
                @event.properties.put(GoogleIMAComponent.ADS_REQUESTS, adsRequests);
                outerInstance.eventEmitter.respond(@event);
            }
コード例 #2
0
            public override void processEvent(Event @event)
            {
                // Create a container object for the ads to be presented.
                AdDisplayContainer container = sdkFactory.createAdDisplayContainer();

                container.Player      = outerInstance.googleIMAComponent.VideoAdPlayer;
                container.AdContainer = brightcoveVideoView;

                // Build an ads request object and point it to the ad
                // display container created above.
                AdsRequest adsRequest = sdkFactory.createAdsRequest();

                adsRequest.AdTagUrl           = outerInstance.adRulesURL;
                adsRequest.AdDisplayContainer = container;

                List <AdsRequest> adsRequests = new List <AdsRequest>(1);

                adsRequests.Add(adsRequest);

                // Respond to the event with the new ad requests.
                @event.properties.put(GoogleIMAComponent.ADS_REQUESTS, adsRequests);
                outerInstance.eventEmitter.respond(@event);
            }