protected virtual void VpaidController_AdStarted(object sender, ActiveCreativeEventArgs e)
 {
     if (CreativeStarted != null)
     {
         CreativeStarted(this, new CreativeEventArgs(e.ActiveCreative.Source));
     }
 }
예제 #2
0
        void player_AdLinearChanged(object sender, EventArgs e)
        {
            var  vp             = sender as IVpaid;
            var  activeCreative = activeAds[vp];
            bool isLinear;

            try
            {
                isLinear = vp.AdLinear;
            }
            catch (Exception ex)
            {
                OnLog(new ActiveCreativeLogEventArgs(activeCreative, "VPAID.AdLinear Exception: " + ex.Message));
                return;
            }
            var args = new ActiveCreativeEventArgs(activeCreative, userStates[activeCreative]);

            if (isLinear)
            {
                if (AdIsLinear != null)
                {
                    AdIsLinear(this, args);
                }
            }
            else
            {
                if (AdIsNotLinear != null)
                {
                    AdIsNotLinear(this, args);
                }
            }
        }
 protected virtual void VpaidController_AdProgressChanged(object sender, ActiveCreativeEventArgs e)
 {
     // bubble up progress changes
     if (CreativeProgressChanged != null)
     {
         CreativeProgressChanged(this, new CreativeProgressEventArgs(e.ActiveCreative.Source, e.ActiveCreative.Player.AdRemainingTime));
     }
 }
 void VpaidController_AdPaused(object sender, ActiveCreativeEventArgs e)
 {
     // bubble up progress changes
     if (CreativePaused != null)
     {
         CreativePaused(this, new CreativeEventArgs(e.ActiveCreative.Source));
     }
 }
 protected virtual void vPaidController_AdCompleted(object sender, ActiveCreativeEventArgs e)
 {
     if (e.ActiveCreative.Player.AdLinear)
     {
         // a linear ad just completed, now is a good time to garbage collect
         GC.Collect();
     }
     RefreshAdMode();
 }
        protected virtual void AdStopped(ActiveCreativeEventArgs e)
        {
            VpaidController.RemoveAd(e.ActiveCreative);

            if (CreativeSucceeded != null)
            {
                CreativeSucceeded(this, new CreativeEventArgs(e.ActiveCreative.Source));
            }
        }
 protected virtual void vPaidController_AdCompleted(object sender, ActiveCreativeEventArgs e)
 {
     if (e.ActiveCreative.Player.AdLinear)
     {
         // a linear ad just completed, now is a good time to garbage collect
         GC.Collect();
     }
     RefreshAdMode();
 }
 protected virtual void vPaidController_AdLoaded(object sender, ActiveCreativeEventArgs e)
 {
     VpaidController.SetVolume(e.ActiveCreative, adHost.Volume);
     VpaidController.StartAd(e.ActiveCreative, e.UserState);
 }
        protected virtual void AdStopped(ActiveCreativeEventArgs e)
        {
            VpaidController.RemoveAd(e.ActiveCreative);

            if (CreativeSucceeded != null)
                CreativeSucceeded(this, new CreativeEventArgs(e.ActiveCreative.Source));
        }
 protected virtual void vPaidController_AdStopped(object sender, ActiveCreativeEventArgs e)
 {
     AdStopped(e);
 }
예제 #11
0
 void VpaidController_AdStopFailed(object sender, ActiveCreativeEventArgs e)
 {
     EndAdPlayback();
 }
예제 #12
0
 void VpaidController_AdApproachingEnd(object sender, ActiveCreativeEventArgs e)
 {
     AdApproachingEnd(e);
 }
 void VpaidController_AdPaused(object sender, ActiveCreativeEventArgs e)
 {
     // bubble up progress changes
     if (CreativePaused != null)
         CreativePaused(this, new CreativeEventArgs(e.ActiveCreative.Source));
 }
 protected override void vPaidController_AdCompleted(object sender, ActiveCreativeEventArgs e)
 {
     // do nothing, we control our own blocking
 }
예제 #15
0
        protected override void AdApproachingEnd(ActiveCreativeEventArgs e)
        {
            // if the current creative is using a player that supports preloading
            // and if the next creative can be preloaded in that player
            // preload it

            if (!(e.ActiveCreative.Player is IVpaidSupportsPreloading))
                return;

            var currentCreative = e.UserState as VastCreative;

            // Find linear creative, either in this ad, or in the next

            var currentCreativeSet = currentCreative.Parent;

            // First look for the next CreativeSet in the current Ad
            var nextCreativeSet = currentCreativeSet.Parent.CreativeSets.SkipWhile(c => c != currentCreativeSet).Skip(1).FirstOrDefault() as VastCreativeSet;

            // If there are no further CreativeSets in the current Ad, look in the next Ad
            if (nextCreativeSet == null)
            {
                var currentAd = currentCreative.Parent.Parent;
                var nextAd = currentAd.Parent.Ads.SkipWhile(a => a != currentAd).Skip(1).FirstOrDefault() as VastAd;

                if (nextAd == null)
                    return;

                nextCreativeSet = nextAd.CreativeSets.FirstOrDefault() as VastCreativeSet;

                if (nextCreativeSet == null)
                    return;
            }

            if (nextCreativeSet.ContainsLinear)
            {
                LinearVastCreative linearCreative = nextCreativeSet.Creatives.OfType<LinearVastCreative>().First();

                if (linearCreative.PreLoad())
                {
                    VpaidController.PreloadAd(linearCreative.ActiveCreative, (int)(adHost.PlaybackBitrate / 1024));
                }
            }
        }
 protected virtual void vPaidController_AdLoaded(object sender, ActiveCreativeEventArgs e)
 {
     VpaidController.SetVolume(e.ActiveCreative, adHost.Volume);
     VpaidController.StartAd(e.ActiveCreative, e.UserState);
 }
 protected virtual void vPaidController_AdStopped(object sender, ActiveCreativeEventArgs e)
 {
     AdStopped(e);
 }
 protected virtual void VpaidController_AdStarted(object sender, ActiveCreativeEventArgs e)
 {
     if (CreativeStarted != null)
         CreativeStarted(this, new CreativeEventArgs(e.ActiveCreative.Source));
 }
        protected override void AdStopped(ActiveCreativeEventArgs e)
        {
            base.AdStopped(e);

            VastCreative creative = e.UserState as VastCreative;
            creative.Succeeded();
        }
 protected virtual void VpaidController_AdProgressChanged(object sender, ActiveCreativeEventArgs e)
 {
     // bubble up progress changes
     if (CreativeProgressChanged != null)
         CreativeProgressChanged(this, new CreativeProgressEventArgs(e.ActiveCreative.Source, e.ActiveCreative.Player.AdRemainingTime));
 }
예제 #21
0
 protected override void VpaidController_AdStarted(object sender, ActiveCreativeEventArgs e)
 {
     base.VpaidController_AdStarted(sender, e);
     UACCreative creative = e.UserState as UACCreative;
     var sourceAd = creative.ParentCreativeSet.ParentAd.Ad;
     SMFPlayer smf = AdHost as SMFPlayer;
     m_adPlaybackToken = AdManager.StartAdPlayback(smf.MediaTransport, sourceAd);
     if (m_adPlaybackToken != null)
     {
         m_adPlaybackToken.EventBack += AdPlaybackTokenBackHandler;
     }
 }
 protected virtual void vPaidController_AdIsLinear(object sender, ActiveCreativeEventArgs e)
 {
     RefreshAdMode();
 }
예제 #23
0
 protected abstract void AdApproachingEnd(ActiveCreativeEventArgs e);
        protected override void AdFailed(ActiveCreativeEventArgs e)
        {
            base.AdFailed(e);

            VastCreative creative = e.UserState as VastCreative;
            creative.Failed();
        }
 protected virtual void vPaidController_AdIsLinear(object sender, ActiveCreativeEventArgs e)
 {
     RefreshAdMode();
 }
 void player_AdLinearChanged(object sender, EventArgs e)
 {
     var vp = sender as IVpaid;
     var activeCreative = activeAds[vp];
     bool isLinear;
     try
     {
         isLinear = vp.AdLinear;
     }
     catch (Exception ex)
     {
         OnLog(new ActiveCreativeLogEventArgs(activeCreative, "VPAID.AdLinear Exception: " + ex.Message));
         return;
     }
     var args = new ActiveCreativeEventArgs(activeCreative, userStates[activeCreative]);
     if (isLinear)
     {
         if (AdIsLinear != null) AdIsLinear(this, args);
     }
     else
     {
         if (AdIsNotLinear != null) AdIsNotLinear(this, args);
     }
 }
예제 #27
0
        protected override void AdStopped(ActiveCreativeEventArgs e)
        {
            EndAdPlayback();
            base.AdStopped(e);

            var creative = e.UserState as UACCreative;
            creative.Succeeded();
        }