Class InstreamAudioAd


  • public final class InstreamAudioAd
    extends BaseAd
    • Constructor Detail

      • InstreamAudioAd

        public InstreamAudioAd​(int slotId,
                               @NonNull
                               android.content.Context context)
        Public constructor
        Parameters:
        slotId - your slot id
        context - app context
    • Method Detail

      • getLoadingTimeout

        public int getLoadingTimeout()
        Returns:
        loading timeout for this Ad
        See Also:
        setLoadingTimeout(int)
      • setLoadingTimeout

        public void setLoadingTimeout​(int loadingTimeout)
        An Ad loading timeout can be set before loading ad. When timeout passes without any callbacks, InstreamAudioAd.InstreamAudioAdListener.onNoAd(String, InstreamAudioAd) will be called. Default value is 10 seconds, minimum 5 seconds. If value less than 5 seconds set, it will be 5 seconds.
        Parameters:
        loadingTimeout - desired timeout in seconds
      • getPlayer

        @Nullable
        public InstreamAudioAdPlayer getPlayer()
        Player was set to play audio ad. If no player was set, method will return null
        Returns:
        player for ad audio playing. Default null
        See Also:
        InstreamAudioAdPlayer
      • getVolume

        public float getVolume()
        Returns:
        volume param
        See Also:
        setVolume(float)
      • setVolume

        public void setVolume​(float volume)
        Allows you to control the volume of audio playback and affects the sending of statistics of sound changes. When the application uses its own implementation of the player, the correct way to control the volume of the Ad is to change this property. Accepts a range of values [0-1], where 1 is max volume and 0 is mute
        Parameters:
        volume - volume param in range [0,1]
      • getMidPoints

        @NonNull
        public float[] getMidPoints()
        Method for getting a list of points at which audio banners will be played. Should be called after calling one of the configureMidpoints(float), or configureMidpointsPercents(float, float[]) methods to get an array of points based on the duration of the main audio and points set by the application.
        Returns:
        array of midroll points available
      • configureMidpoints

        public void configureMidpoints​(float audioDuration)
        Sets the duration of the main audio. When using this method, the points for playing the banners will be resolved automatically.
        Parameters:
        audioDuration - duration of the audio, where should be midpoints
      • configureMidpoints

        public void configureMidpoints​(float audioDuration,
                                       @Nullable
                                       float[] midpoints)
        Sets the duration of the main audio. Points will be resolved as much as possible close to the desired midpoints array
        Parameters:
        audioDuration - duration of the audio, where should be midpoints
        midpoints - an array with desired positions
      • configureMidpointsPercents

        public void configureMidpointsPercents​(float audioDuration,
                                               @Nullable
                                               float[] midpointsPercents)
        Allows you to set the duration of the main audio in seconds and an array of banner midroll points in percent.
        Parameters:
        audioDuration - duration of the audio, where should be midpoints
        midpointsPercents - an array with desired positions in percents
      • pause

        public void pause()
        Pauses ad audio
      • resume

        public void resume()
        Resumes ad audio from pause
      • stop

        public void stop()
        Stops ad audio
      • skip

        public void skip()
        Explicitly ends playing current section/sequence of ad audios.
      • skipBanner

        public void skipBanner()
        Explicitly ends playing current audio banner. Starts next banner then, if exists, or finishes playing audio ads section
      • destroy

        public void destroy()
        Destroys the ad and frees resources
      • startPreroll

        public void startPreroll()
        Starts the "preroll" section of audio ad
      • startPostroll

        public void startPostroll()
        Starts the "postroll" section of audio ad
      • startPauseroll

        public void startPauseroll()
        Starts the "pauseroll" section of audio ad
      • startMidroll

        public void startMidroll​(float point)
        Starts the "midroll" section of audio ad at point. An array of available midroll points can be get getMidPoints()