Class InstreamAd

    • Constructor Detail

      • InstreamAd

        InstreamAd(int slotId, Context context)
        Public constructor
        Parameters:
        slotId - your slot id
        context - app context
      • InstreamAd

        InstreamAd(int slotId, MenuFactory adChoicesMenuFactory, Context context)
        Public constructor
        Parameters:
        slotId - your slot id
        adChoicesMenuFactory - adChoice rendering factory
        context - app context
      • InstreamAd

        InstreamAd(String json, Context context)
        Public constructor
        Parameters:
        json - your json-content
        context - app context
      • InstreamAd

        InstreamAd(String json, MenuFactory adChoicesMenuFactory, Context context)
        Public constructor
        Parameters:
        json - your json-content
        adChoicesMenuFactory - adChoice rendering factory
        context - app context
    • Method Detail

      • configureMidpoints

         void configureMidpoints(float videoDuration)

        Sets the duration of the main video. When using this method, the points for playing the banners will be resolved automatically.

        Parameters:
        videoDuration - duration of the video, where should be midpoints
      • configureMidpoints

         void configureMidpoints(float videoDuration, @Nullable() Array<float> midpoints)

        Sets the duration of the main video. Points will be resolved as much as possible close to the desired midpoints array

        Parameters:
        videoDuration - duration of the video, where should be midpoints
        midpoints - an array with desired positions
      • configureMidpointsPercents

         void configureMidpointsPercents(float videoDuration, @Nullable() Array<float> midpointsPercents)

        Allows you to set the duration of the main video in seconds and an array of banner midroll points in percent.

        Parameters:
        videoDuration - duration of the video, where should be midpoints
        midpointsPercents - an array with desired positions in percents
      • destroy

         void destroy()

        Destroys the ad and frees resources

      • getPlayer

        @Nullable() InstreamAdPlayer getPlayer()

        Player was set to play video ad. If no player was set, method will return null

        Returns:

        player for ad video playing. Null if default set

      • getShoppableView

        @Nullable() View getShoppableView(@NonNull() Context context)

        Get the web view with shoppable ad that contains in companion

      • getVideoQuality

         int getVideoQuality()

        Gets desired video quality of loading video. In vertical pixels.

        Returns:

        video

      • getVideoSectionNames

        @NonNull() List<String> getVideoSectionNames()

        Video section is sequence of videos based on position inside video. There are "preroll", "postroll", "midroll", "pauseroll". For example, if Ad has only "preroll" section name, there are some banners in preroll section, and they will start when InstreamAd.startPreroll() called, and nothing will happen if InstreamAd.startPostroll() called. Ad can contain one or multiple video sections to play. This method represents available sections for this ad.

        Returns:

        list of available video section names

      • getVolume

         float getVolume()
        Returns:

        volume param

      • handleAdChoicesClick

         void handleAdChoicesClick(@NonNull() Context context)

        Call to display adChoices

      • handleClick

         void handleClick()

        This should be called when user clicks on ad call-to-action element. Goes to the ad placement according banner logic and calls click statistics

      • handleCompanionClick

         void handleCompanionClick(@NonNull() InstreamAd.InstreamAdCompanionBanner instreamAdCompanionBanner, @NonNull() Context context)

        Opens companion's tracking link and click statistics with context

        Parameters:
        instreamAdCompanionBanner - clicked companion
        context - context to handle intent
      • isFullscreen

         boolean isFullscreen()
        Returns:

        param is ad in fullscreen mode or not

      • isShoppablePresented

         boolean isShoppablePresented()
        Returns:

        param is shoppable ad presented or not

      • pause

         void pause()

        Pauses ad video

      • preparePauseroll

         void preparePauseroll(@NonNull() InstreamAd.SectionPrepareCallback sectionPrepareCallback)

        Initiate prepare for the "pauseroll" section of video ad.

        Parameters:
        sectionPrepareCallback - SDK will call this callback after prepare is completed.
      • preparePostroll

         void preparePostroll(@NonNull() InstreamAd.SectionPrepareCallback sectionPrepareCallback)

        Initiate prepare for the "postroll" section of video ad.

        Parameters:
        sectionPrepareCallback - SDK will call this callback after prepare is completed.
      • resume

         void resume()

        Resumes ad video from pause

      • setFullscreen

         void setFullscreen(boolean fullscreen)

        The fullscreen property is intended to inform the InstreamAd component about changing the video playback mode to fullscreen and back. Changing this property affects the sending of the corresponding statistics.

        Parameters:
        fullscreen - param is ad in fullscreen mode or not
      • setLoadingTimeout

         void setLoadingTimeout(int loadingTimeout)

        An Ad loading timeout can be set before loading ad. When timeout passes without any callbacks, InstreamAdListener.onNoAd(IAdLoadingError, InstreamAd) 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
      • setShoppablePresented

         void setShoppablePresented(boolean isPresented)

        The fullscreen property is intended to inform the InstreamAd component about showing shoppable ad while playing video or not. Changing this property affects the sending of the corresponding statistics.

        Parameters:
        isPresented - param is shoppable ad presented or not
      • setVideoQuality

         void setVideoQuality(int videoQuality)

        Desired video quality can be set. In vertical pixels. For example, if called setVideoQuality(360) SDK will try to show video with nearest size, so if ad has ad video with 480x800 and 1920x1080 sizes, 480x800 will be used. Default is 360

        Parameters:
        videoQuality - desired quality in vertical pixels
      • setVolume

         void setVolume(float volume)

        Allows you to control the volume of video 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]
      • shoppableAdsItemClick

         void shoppableAdsItemClick(@NonNull() String shoppableAdsItemId)

        Must be called when the rendered ShoppableAdsItem has been clicked.

        Parameters:
        shoppableAdsItemId - is ShopppableAdsItem.
      • shoppableAdsItemShow

         void shoppableAdsItemShow(@NonNull() String shoppableAdsItemId)

        Should be called when you have rendered the ShoppableAdsItem

        Parameters:
        shoppableAdsItemId - is ShoppableAdsItem.
      • skip

         void skip()

        Explicitly ends playing current section/sequence of ad videos.

      • skipBanner

         void skipBanner()

        Explicitly ends playing current video banner. Starts next banner then, if exists, or finishes playing video ads section

      • startMidroll

         void startMidroll(float point)

        Starts the "midroll" section of video ad at point. An array of available midroll points can be get InstreamAd.getMidPoints().

        InstreamAdPlayer must be set before calling this function via setPlayer.

      • startPauseroll

         void startPauseroll()

        Starts the "pauseroll" section of video ad

      • startPostroll

         void startPostroll()

        Starts the "postroll" section of video ad

      • startPreroll

         void startPreroll()

        Starts the "preroll" section of video ad

      • stop

         void stop()

        Stops ad video

      • swapPlayer

         void swapPlayer(@Nullable() InstreamAdPlayer player)

        Swaps player to another with saving it's state. When app have multiple players, for example, main and small preview players, use this method to swich from one player to another instead of InstreamAd.setPlayer(InstreamAdPlayer)

        Parameters:
        player - another player to smooth switch with saving state of video
      • useDefaultPlayer

         void useDefaultPlayer()

        Sets the default player to play video ads.

      • useDefaultPlayer

         void useDefaultPlayer(boolean useExoPlayer)

        Sets the default player to play video ads.

        Parameters:
        useExoPlayer - determines whether to use ExoPlayer (androidx.