protected override void OnMarkerReached(AdMarker mediaMarker, bool skippedInto) { var ad = mediaMarker.ScheduledAd; if (!PlayAdsOnSeek && skippedInto) { // don't handle if seeked into player.SendLogEntry(KnownLogEntryTypes.AdSkippedFromSeek, Plugins.Primitives.LogLevel.Information, string.Format(SilverlightMediaFrameworkResources.AdSkippedFromSeek, ad.Trigger.Id), this.GetType().Name); ad.Deactivate(); return; } if (!PlayAdsOnFwdRwd) { // don't handle if rewind or fast forward if (player.ActiveMediaPlugin != null && player.ActiveMediaPlugin.PlaybackRate != 1.0) { // Not supporting rewind or fast forward player.SendLogEntry(KnownLogEntryTypes.AdSkippedFromFwdRwd, Plugins.Primitives.LogLevel.Information, string.Format(SilverlightMediaFrameworkResources.AdSkippedFromFwdRwd, ad.Trigger.Id), this.GetType().Name); ad.Deactivate(); return; } } if (PayloadHandlers != null) { if (ad != null) { var unit = TriggerAd(ad.Trigger); if (unit != null) { //if it returns us a payload, it handled it. ad.Payload = unit; unit.ActiveSourceChanged += new EventHandler(unit_ActiveSourceChanged); unit.Deactivated += new EventHandler(unit_Deactivated); //ActiveAd = ad; } else { player.SendLogEntry(KnownLogEntryTypes.AdNotHandled, Plugins.Primitives.LogLevel.Error, string.Format(SilverlightMediaFrameworkResources.AdNotHandled, ad.Trigger.Id), this.GetType().Name); // no one handled it, deactivate it ASAP. ad.Deactivate(); } } } base.OnMarkerReached(mediaMarker, skippedInto); }