private AdSequencingPayload TriggerAd(IAdSequencingTrigger Trigger) { var activeAdPod = new AdSequencingPayload(Trigger); activeAdPod.WasAtLivePosition = player.IsMediaLive && player.IsPositionLive; activeAdPod.ActiveSource = ProcessNextAdInQueue(activeAdPod.AdQueue); if (activeAdPod.ActiveSource != null) { return(activeAdPod); } else { return(null); } }
ScheduledAd IPlayer.ScheduleAdTrigger(IAdSequencingTrigger adTrigger, TimeSpan?startTime) { return(this.ScheduleAdTrigger(adTrigger, startTime)); }
/// <summary> /// Creates a new AdSequencingPayload /// </summary> /// <param name="Trigger">The trigger causing this payload to be created</param> internal AdSequencingPayload(IAdSequencingTrigger Trigger) { adQueue = new Queue<IAdSequencingSource>(Trigger.Sources); }
ScheduledAd IPlayer.ScheduleAdTrigger(IAdSequencingTrigger adTrigger, TimeSpan? startTime) { return this.ScheduleAdTrigger(adTrigger, startTime); }
/// <summary> /// Creates a new ScheduledAd. /// </summary> /// <param name="Trigger">The ad sequencing trigger that defines source and target information for the ad.</param> public ScheduledAd(IAdSequencingTrigger Trigger) { trigger = Trigger; }
/// <summary> /// Schedules an ad that is to be handled by an AdPayloadHandlerPlugin. /// A valid AdPayloadHandlerPlugin must be part of your application or this will not be handled. /// </summary> /// <param name="adTrigger">An object containing information about the ad source and target</param> /// <param name="startTime">The position within the media where this ad should be played. If ommited ad will begin playing immediately.</param> /// <returns>An object that contains information about the scheduled ad.</returns> public ScheduledAd ScheduleAdTrigger(IAdSequencingTrigger adTrigger, TimeSpan? startTime = null) { var adStartTime = startTime.GetValueOrDefault(RelativeMediaPluginPosition); var result = new ScheduledAd(adTrigger); var adMarker = new AdMarker() { Immediate = !startTime.HasValue, Begin = adStartTime, Id = Guid.NewGuid().ToString(), ScheduledAd = result, End = adStartTime.Add(adTrigger.Duration.GetValueOrDefault(TimeSpan.FromDays(1))) // update the end based on the duration }; // Immediate == true will trigger the timeline marker immediately instead of waiting for polling to occur if (adMarker.Immediate) { var duration = adMarker.Duration; adMarker.Begin = RelativeMediaPluginPosition; adMarker.End = adMarker.Begin.Add(duration); // update the end based on the duration AdMarkers.Add(adMarker); // force a check on the postions, we know there is one that needs to be fired if (!isSeekActive) _adMarkerManager.CheckMarkerPositions(RelativeMediaPluginPosition, AdMarkers, seekInProgress); } else { AdMarkers.Add(adMarker); } return result; }
/// <summary> /// Creates a new AdSequencingPayload /// </summary> /// <param name="Trigger">The trigger causing this payload to be created</param> internal AdSequencingPayload(IAdSequencingTrigger Trigger) { adQueue = new Queue <IAdSequencingSource>(Trigger.Sources); }