Help Center/Details/

Interstitial Video

Load Interstitial Video Ad

We would recommend you that preload the ad and set up the callback event, since it takes time to load video ads.

    /// <summary>
    /// Loads the full screen video ad.
    /// </summary>
    public void LoadExpressFullScreenVideoAd()
    {
#if UNITY_IOS
        if (this.expressFullScreenVideoAd != null)
        {
            Debug.LogError("Ad is already loaded");
            this.information.text = "Ad is already loaded";
            return;
        }
#endif

        string iosSlotID = "945113164";
        string AndroidSlotID = "901121073";
        //Landscape
        if (this.getScreenOrientationConfig() == 1)
        {
            iosSlotID = "945113165";
            AndroidSlotID = "901121516";
        }

        var adSlot = new AdSlot.Builder()
#if UNITY_IOS
        // 900546551 -> Portrait
        // 900546831 -> Landscape
        .SetCodeId(iosSlotID)
#else
        .SetCodeId(AndroidSlotID)
#endif
        .SetOrientation(AdOrientation.Horizontal)
        .Build();
        
#if UNITY_IOS     this.AdNative.LoadExpressFullScreenVideoAd(adSlot, new ExpressFullScreenVideoAdListener(this));
        
#else    this.AdNative.LoadFullScreenVideoAd(adSlot, new FullScreenVideoAdListener(this));
#endif
    }

Display Interstitial Video Ad

Call the method ShowFullScreenVideoAd after successfully loading an ad.
It is recommended to display ad after OnFullScreenVideoCached to enjoy better ad performance.

    /// <summary>
    /// Show the reward Ad.
    /// </summary>
    public void ShowExpressFullScreenVideoAd()
    {
#if UNITY_IOS
        if (this.expressFullScreenVideoAd == null)
        {
            Debug.LogError("No ad to show");
            this.information.text = "No ad to show";
            return;
        }
        this.expressFullScreenVideoAd.ShowFullScreenVideoAd();
#else
        if (this.fullScreenVideoAd == null)
        {
            Debug.LogError("No ad to show");
            this.information.text = "No ad to show";
            return;
        }
        this.fullScreenVideoAd.ShowFullScreenVideoAd();
        this.fullScreenVideoAd = null;

#endif
    }

Monitoring Settings of Interstitial Video Ad

To further customize the behavior of your ad, you can hook into a number of events in the ad's lifecycle

/// <summary>
    /// Full screen ad interaction listener.
    /// </summary>
    private sealed class FullScreenAdInteractionListener : IFullScreenVideoAdInteractionListener
    {
        private Example example;

        public FullScreenAdInteractionListener(Example example)
        {
            this.example = example;
        }

        public void OnAdShow()
        {
            Debug.Log("fullScreenVideoAd show");
            this.example.information.text = "fullScreenVideoAd show";
        }

        public void OnAdVideoBarClick()
        {
            Debug.Log("fullScreenVideoAd bar click");
            this.example.information.text = "fullScreenVideoAd bar click";
        }

        public void OnAdClose()
        {
            Debug.Log("fullScreenVideoAd close");
            this.example.information.text = "fullScreenVideoAd close";
            this.example.fullScreenVideoAd = null;
            #if UNITY_IOS
            this.example.expressFullScreenVideoAd = null;
#endif
            
        }

        public void OnVideoComplete()
        {
            Debug.Log("fullScreenVideoAd complete");
            this.example.information.text = "fullScreenVideoAd complete";
        }

        public void OnVideoError()
        {
            Debug.Log("fullScreenVideoAd OnVideoError");
            this.example.information.text = "fullScreenVideoAd OnVideoError";
        }

        public void OnSkippedVideo()
        {
            Debug.Log("fullScreenVideoAd OnSkippedVideo");
            this.example.information.text = "fullScreenVideoAd skipped";

        }
    }

Interstitial Video Ad Destruction

Since the Interstitial video ad is always referenced, the corresponding resource will not be released and needs to be released by yourself.

public void DisposeAds()
{
#if UNITY_IOS
    if (this.fullScreenVideoAd != null)
    {
        this.fullScreenVideoAd.Dispose();
        this.fullScreenVideoAd = null;
    }
#else
    if (this.fullScreenVideoAd != null)
    {
        this.fullScreenVideoAd = null;
    }
#endif
}

If you need more than one full-screen video ad, it is recommended to create multiple FullScreenVideoAd to manage the corresponding video separately. If only one is displayed at a time, LoadFullScreenVideoAd can be called after the first full-screen video ad closes to load the new full-screen video ad. Please refer to the demo example for specific usage.

Reference

FullScreenVideoAd Interface

/// <summary>
        /// The full screen video Ad.
        /// </summary>
        public sealed class ExpressFullScreenVideoAd
        {
             public void Dispose()
            {
            }
            /// <summary>
            /// Sets the interaction listener for this Ad.
            /// </summary>
            public void SetFullScreenVideoAdInteractionListener(
                IFullScreenVideoAdInteractionListener listener)
            {
            }
            /// <summary>
            /// Sets the listener for the Ad download.
            /// </summary>
            public void SetDownloadListener(IAppDownloadListener listener)
            {
            }
            /// <summary>
            /// Gets the interaction type.
            /// </summary>
            public int GetInteractionType()
            {
                return 0;
            }
            /// <summary>
            /// Show the full screen video.
            /// </summary>
            public void ShowFullScreenVideoAd()
            {
            }
            /// <summary>
            /// Set to show the download bar.
            /// </summary>
            public void SetShowDownLoadBar(bool show)
            {
            }
        }
Did the content solve your problem?