Class GoogleIMAVideoAdPlayer

  • All Implemented Interfaces:
    AdPlayer.Listener<AdAsset>, com.google.ads.interactivemedia.v3.api.player.AdProgressProvider, com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, com.google.ads.interactivemedia.v3.api.player.VolumeProvider

    public class GoogleIMAVideoAdPlayer
    extends java.lang.Object
    implements com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, AdPlayer.Listener<AdAsset>
    • Method Detail

      • setAd

        public void setAd​(@Nullable
                          com.google.ads.interactivemedia.v3.api.Ad imaAd)
      • getAd

        @Nullable
        public com.google.ads.interactivemedia.v3.api.Ad getAd()
      • getCurrentPosition

        public int getCurrentPosition()
      • getCurrentPositionLong

        public long getCurrentPositionLong()
      • start

        @Deprecated
        public void start()
        Deprecated.
        Starts or resumes playback. If playback had previously been paused, playback will continue from where it was paused. If playback had been stopped, or never started before, playback will start at the beginning.
      • isPlaying

        public boolean isPlaying()
        Returns:
        Whether the ad player is playing.
      • seekTo

        public void seekTo​(long adPosition)
      • release

        public void release()
        Specified by:
        release in interface com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer
      • loadAd

        public void loadAd​(com.google.ads.interactivemedia.v3.api.player.AdMediaInfo adMediaInfo,
                           @Nullable
                           com.google.ads.interactivemedia.v3.api.AdPodInfo adPodInfo)
        Specified by:
        loadAd in interface com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer
      • playAd

        public void playAd​(com.google.ads.interactivemedia.v3.api.player.AdMediaInfo adMediaInfo)
        Specified by:
        playAd in interface com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer
      • pauseAd

        public void pauseAd​(com.google.ads.interactivemedia.v3.api.player.AdMediaInfo adMediaInfo)
        Specified by:
        pauseAd in interface com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer
      • skipAd

        public void skipAd()
      • stopAd

        public void stopAd​(com.google.ads.interactivemedia.v3.api.player.AdMediaInfo adMediaInfo)
        Specified by:
        stopAd in interface com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer
      • addCallback

        public void addCallback​(com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback videoAdPlayerCallback)
        Specified by:
        addCallback in interface com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer
      • removeCallback

        public void removeCallback​(com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback videoAdPlayerCallback)
        Specified by:
        removeCallback in interface com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer
      • getAdProgress

        public com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate getAdProgress()
        Specified by:
        getAdProgress in interface com.google.ads.interactivemedia.v3.api.player.AdProgressProvider
      • getVolume

        public int getVolume()
        Specified by:
        getVolume in interface com.google.ads.interactivemedia.v3.api.player.VolumeProvider
      • onAdProgress

        public void onAdProgress​(long position,
                                 @NonNull
                                 AdAsset ad)
        Description copied from interface: AdPlayer.Listener
        Called when an ad has made progress.
        Specified by:
        onAdProgress in interface AdPlayer.Listener<AdAsset>
        Parameters:
        position - the current position of the playback in milliseconds.
        ad - the current ad being played.
      • onDurationChanged

        public void onDurationChanged​(long duration)
        Description copied from interface: AdPlayer.Listener
        Called when an Ad duration has been changed.
        Specified by:
        onDurationChanged in interface AdPlayer.Listener<AdAsset>
        Parameters:
        duration - the duration of the current Ad.
      • onError

        public void onError​(@NonNull
                            AdAsset ad,
                            @NonNull
                            java.lang.Exception e)
        Description copied from interface: AdPlayer.Listener
        Called when an error happened.
        Specified by:
        onError in interface AdPlayer.Listener<AdAsset>
        Parameters:
        ad - the ad that failed to play and originated the error.
        e - exception.
      • getCurrentAdMediaInfo

        @Nullable
        public com.google.ads.interactivemedia.v3.api.player.AdMediaInfo getCurrentAdMediaInfo()
        Returns the current AdMediaInfo, or null otherwise.
      • getMainHandler

        public android.os.Handler getMainHandler()