Ejemplo n.º 1
0
        /// <summary>
        /// AdHandler sent ad, preparations can be started.
        /// </summary>
        /// <param name="ad"></param>
        private void OnAdReady(VPlayableAd ad)
        {
            VPlayerController.Instance.SetSplashActive(false);
            m_currentAd = ad;

            if (m_currentAd == null)
            {
                OnError("Current ad is null");
                return;
            }

            StartCoroutine(PrepareAd(m_currentAd.GetMediaUrl()));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Start ad playback
        /// </summary>
        /// <param name="clip"></param>
        private void StartPlayback(AudioClip clip)
        {
            DisposeCurrentAudio();

            if (m_isBannerTextureLoaded)
            {
                VPlayerController.Instance.SetAdBannerActive(true);
            }

            if (m_adContainsBanner && m_isBannerTextureLoaded)
            {
                m_currentAd.DoEventTracking(VStrings.Ad_CreativeView);
            }

            m_currentAd.DoEventTracking(VStrings.Ad_Start);

            if (m_currentAd != null && m_currentAd.GetImpressionUrls().Count > 0)
            {
                // Adswizz requires impression calls at start, other networks at completion
                if (m_currentAd.GetMediaUrl().Contains("adswizz"))
                {
                    foreach (var imprToCall in m_currentAd.GetImpressionUrls())
                    {
                        m_network.CallGet(imprToCall, null);
                    }
                }
            }
            else
            {
                OnError("Error calling impressions!");
            }

            m_isAdStarted = true;

            m_audioSource.clip = clip;
            m_audioSource.Play();

            OnStarted();
        }