Interface InstreamAdPlayer


  • @MainThread
    public interface InstreamAdPlayer
    This interface is used for playing instream ad
    • Method Detail

      • prepareAd

        void prepareAd​(@NonNull
                       VideoAd videoAd)
        Prepares player for playing video ad. Implement only this method for prepare Ad.
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
      • playAd

        void playAd​(@NonNull
                    VideoAd videoAd)
        Starts playing ad
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
      • pauseAd

        void pauseAd​(@NonNull
                     VideoAd videoAd)
        Pauses playing ad
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
      • resumeAd

        void resumeAd​(@NonNull
                      VideoAd videoAd)
        Resumes playing ad
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
      • stopAd

        void stopAd​(@NonNull
                    VideoAd videoAd)
        Stops playing ad
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
      • skipAd

        void skipAd​(@NonNull
                    VideoAd videoAd)
        Skips playing ad
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
      • setVolume

        void setVolume​(@NonNull
                       VideoAd videoAd,
                       float volume)
        Sets ad player volume, with 0 being silence and 1 being maximum volume level
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
        volume - volume level in range [0.0, 1.0]
      • getVolume

        float getVolume​(@NonNull
                        VideoAd videoAd)
        Gets player volume level in range [0.0, 1.0]
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
        Returns:
        player volume level in range [0.0, 1.0]
      • releaseAd

        void releaseAd​(@NonNull
                       VideoAd videoAd)
        Releases ad player object
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
      • setInstreamAdPlayerListener

        void setInstreamAdPlayerListener​(@Nullable
                                         InstreamAdPlayerListener instreamAdPlayerListener)
        Sets listener for ad player events. For each event of the instream ad player, the corresponding callback must be called on this object.
        Parameters:
        instreamAdPlayerListener - Listener for ad player events
      • getAdDuration

        long getAdDuration​(@NonNull
                           VideoAd videoAd)
        Gets ad video duration
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
        Returns:
        ad video position in millis
      • getAdPosition

        long getAdPosition​(@NonNull
                           VideoAd videoAd)
        Gets current ad video position
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
        Returns:
        current ad video duration in millis
      • isPlayingAd

        boolean isPlayingAd​(@NonNull
                            VideoAd videoAd)
        Gets value indicating whether player is playing ad
        Parameters:
        videoAd - object providing information about the advertising video file to be played. videoAd should be passed back in all callbacks to InstreamAdPlayerListener
        Returns:
        value indicating whether player is playing ad