/// <summary> /// Fires when the ad has completed running (regardless of the reason). /// </summary> private void unit_Deactivated(object sender, EventArgs e) { var unit = sender as AdSequencingPayload; unit.Deactivated -= new EventHandler(unit_Deactivated); unit.ActiveSourceChanged -= new EventHandler(unit_ActiveSourceChanged); //ActiveAd = null; // the ad has completed, make sure at live position if watching live stream // and close to the live position... jump to live if the current position // after ad plays is within LivePositionBufferDuration of the actual // live position, this is already calculated in the IsPositionLive property // We also have a setting that turns this on/off if (JumpToLiveAfterAd && player.IsMediaLive && unit.WasAtLivePosition) { player.SeekToLive(); } }