Interface InstreamAd
-
- All Implemented Interfaces:
public interface InstreamAdInterface for managing the in-stream ad.
-
-
Method Summary
Modifier and Type Method Description abstract UnitsetInstreamAdPlaybackListener(InstreamAdPlaybackListener listener)Sets a listener to receive in-stream ad playback events. abstract UnitattachPlayerView(ViewGroup container)Attaches the in-stream ad's player view to the specified container. abstract Unitstart()Starts playback of the in-stream ad. abstract Unitskip()Skips the current video in the in-stream ad. abstract Unitstop()Stops the playback of the in-stream ad. abstract UnithandleClick()Handles a user click on the in-stream ad. abstract UnitsetVolume(Float volume)Sets the playback volume for the in-stream ad. abstract Unitcustomize(Function1<CustomPlayer, Unit> block)Provides access to the CustomPlayer interface to customize the player view. abstract IntegergetVideoCount()The number of video ads contained in this in-stream ad. -
-
Method Detail
-
setInstreamAdPlaybackListener
abstract Unit setInstreamAdPlaybackListener(InstreamAdPlaybackListener listener)
Sets a listener to receive in-stream ad playback events.
- Parameters:
listener- The InstreamAdPlaybackListener to receive playback events, ornullto remove the current listener.
-
attachPlayerView
abstract Unit attachPlayerView(ViewGroup container)
Attaches the in-stream ad's player view to the specified container.
- Parameters:
container- The root view in which the ad player should be embedded.
-
skip
abstract Unit skip()
Skips the current video in the in-stream ad.
This method should only be called if the current video time exceeds the VideoAd.skipOffset. You can monitor time updates using InstreamAdPlaybackListener.onVideoAdTimeLeftChange.
-
stop
abstract Unit stop()
Stops the playback of the in-stream ad.
After calling this method, the ad cannot be played again.
-
handleClick
abstract Unit handleClick()
Handles a user click on the in-stream ad.
If you use a custom clickable area, call this method to notify the in-stream ad of the click.
-
setVolume
abstract Unit setVolume(Float volume)
Sets the playback volume for the in-stream ad.
The default volume is
0(muted).- Parameters:
volume- The desired volume as a percentage of the device's current volume.
-
customize
abstract Unit customize(Function1<CustomPlayer, Unit> block)
Provides access to the CustomPlayer interface to customize the player view.
- Parameters:
block- A lambda with CustomPlayer as receiver to configure the player UI.
-
getVideoCount
abstract Integer getVideoCount()
The number of video ads contained in this in-stream ad.
-
-
-
-