public class

SVSAdManager

extends Object
java.lang.Object
   ↳ com.smartadserver.android.instreamsdk.admanager.SVSAdManager

Class Overview

The SVSAdManager is the class responsible for loading ads and displaying them into the ad player. This class is instantiated with a SVSAdPlacement, a set of SVSAdRule, a SVSAdPlayerConfiguration object and is started with an Object implementing the SVSContentPlayerPlugin interface that makes the connection with the content player

Summary

Nested Classes
interface SVSAdManager.AdBreakEventListener This interface is deprecated. ad break events can now be monitored via SVSAdManager.AdManagerListener  
interface SVSAdManager.AdManagerListener Interface for Objects that will monitor SVSAdManager main events and actions  
interface SVSAdManager.UIInteractionListener Interface for Objects that will respond to interactions with the ad player controls (like enter fullscreen/ exit fullscreen requests for now)  
Public Constructors
SVSAdManager(Context context, SVSAdPlacement placement, SVSAdRule[] adRules, SVSAdPlayerConfiguration adPlayerConfiguration, SVSContentData contentData)
Main constructor
Public Methods
void addAdBreakEventListener(SVSAdManager.AdBreakEventListener listener)
This method is deprecated. use addAdManagerListener(AdManagerListener) instead
void addAdManagerListener(SVSAdManager.AdManagerListener listener)
Add a SVSAdManager.AdManagerListener to this SVSAdManager
void addUIInteractionListener(SVSAdManager.UIInteractionListener listener)
Adds a SVSAdManager.UIInteractionListener to this SVSAdManager.
synchronized void cancelAdLoading()
Cancel any pending ad loading process
SVSAdPlacement getAdPlacement()
Returns the SVSAdPlacement instance associated with this SVSAdManager instance
SVSAdPlayerConfiguration getAdPlayerConfiguration()
Returns the current SVSAdPlayerConfiguration in use
double getPlayheadPosition()
void notifyContentHasCompleted()
Manually notifies the SVSAdManager instance that the content has reached its end (in case it can not be properly detected internally)
void onAdPlaybackClickThroughEvent(String url)
void onAdPlaybackEvent(SVSAdPlaybackEvent event)
synchronized void onDestroy()
Releases resources allocated by this SVSAdManager.
void onFullscreenStateChange(boolean isFullscreen)
Tells the ad manager that your content player entered / exited fullscreen mode.
void onPause()
Notifies this SVSAdManager that the hosting Activity's onPause() method was called
void onResume()
Notifies this SVSAdManager that the hosting Activity's onResume() method was called
void removeAdBreakEventListener(SVSAdManager.AdBreakEventListener listener)
This method is deprecated. use removeAdManagerListener(AdManagerListener) instead
void removeAdManagerListener(SVSAdManager.AdManagerListener listener)
Add a SVSAdManager.AdManagerListener to this SVSAdManager
void removeUIInteractionListener(SVSAdManager.UIInteractionListener listener)
Removes a SVSAdManager.UIInteractionListener from this SVSAdManager.
void replay()
Tells the ad manager that your content is being replayed (after being completed).
void resumeContent()
Will resume the content monitoring.
void setCreativeMediaURIProvider(SVSMediaURIProvider provider)
Sets the SVSMediaURIProvider object used to determine the URI of the actual media to play for a given VAST media url (for media caching for instance)
synchronized void start(SVSContentPlayerPlugin contentPlayerPlugin)
Starts the ad playback process on the content player represented by the SVSContentPlayerPlugin object
void startAdBreak()
Will start the waiting ad break, if any.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SVSAdManager (Context context, SVSAdPlacement placement, SVSAdRule[] adRules, SVSAdPlayerConfiguration adPlayerConfiguration, SVSContentData contentData)

Main constructor

Parameters
context the Android Context to attach to
placement the SVSAdPlacement identifying this inventory item
adRules an array of SVSAdRule instances that determines the ad playback configuration depending on the content properties
adPlayerConfiguration the SVSAdPlayerConfiguration object containing ad playback parameters
contentData an optional SVSContentData object containing properties about the content video
Throws
IllegalArgumentException thrown if any of the parameters is incorrect

Public Methods

public void addAdBreakEventListener (SVSAdManager.AdBreakEventListener listener)

This method is deprecated.
use addAdManagerListener(AdManagerListener) instead

Add a SVSAdManager.AdBreakEventListener to this SVSAdManager

public void addAdManagerListener (SVSAdManager.AdManagerListener listener)

Add a SVSAdManager.AdManagerListener to this SVSAdManager

public void addUIInteractionListener (SVSAdManager.UIInteractionListener listener)

Adds a SVSAdManager.UIInteractionListener to this SVSAdManager.

Parameters
listener an SVSAdManager.UIInteractionListener instance.

public synchronized void cancelAdLoading ()

Cancel any pending ad loading process

public SVSAdPlacement getAdPlacement ()

Returns the SVSAdPlacement instance associated with this SVSAdManager instance

public SVSAdPlayerConfiguration getAdPlayerConfiguration ()

Returns the current SVSAdPlayerConfiguration in use

public double getPlayheadPosition ()

public void notifyContentHasCompleted ()

Manually notifies the SVSAdManager instance that the content has reached its end (in case it can not be properly detected internally)

public void onAdPlaybackClickThroughEvent (String url)

public void onAdPlaybackEvent (SVSAdPlaybackEvent event)

public synchronized void onDestroy ()

Releases resources allocated by this SVSAdManager. Should be called only when the SVSAdManager instance is no longer needed, as it will not accept any further calls.

public void onFullscreenStateChange (boolean isFullscreen)

Tells the ad manager that your content player entered / exited fullscreen mode.

The ad player view will always stick to your container view even when you resize or rotate it. However, the ad manager needs to know about your fullscreen status to keep the fullscreen button status up to date when playing ad breaks. This is particularly important if your application responds to orientation changes by entering / exiting fullscreen.

Parameters
isFullscreen Whether or not the content player is in fullscreen mode.

public void onPause ()

Notifies this SVSAdManager that the hosting Activity's onPause() method was called

public void onResume ()

Notifies this SVSAdManager that the hosting Activity's onResume() method was called

public void removeAdBreakEventListener (SVSAdManager.AdBreakEventListener listener)

This method is deprecated.
use removeAdManagerListener(AdManagerListener) instead

Add a SVSAdManager.AdBreakEventListener to this SVSAdManager

public void removeAdManagerListener (SVSAdManager.AdManagerListener listener)

Add a SVSAdManager.AdManagerListener to this SVSAdManager

public void removeUIInteractionListener (SVSAdManager.UIInteractionListener listener)

Removes a SVSAdManager.UIInteractionListener from this SVSAdManager.

Parameters
listener an SVSAdManager.UIInteractionListener instance.

public void replay ()

Tells the ad manager that your content is being replayed (after being completed). You should make sure your content player seeks to the beginning of the content video before calling this method.

This will reset the status of preroll and postroll advertisements so they can be served again. Note: this method has no impact on midroll advertisements. They will continue playing according to the appropriate ad rule and content plugin status.

public void resumeContent ()

Will resume the content monitoring. To use only if you have disable the adbreak autoplay. Warnings: if you do not call this method, the ad break will never fully end and the SDK will be paused waiting for this method call. More information in the official documentation.

public void setCreativeMediaURIProvider (SVSMediaURIProvider provider)

Sets the SVSMediaURIProvider object used to determine the URI of the actual media to play for a given VAST media url (for media caching for instance)

public synchronized void start (SVSContentPlayerPlugin contentPlayerPlugin)

Starts the ad playback process on the content player represented by the SVSContentPlayerPlugin object

Parameters
contentPlayerPlugin the Object implementing the SVSContentPlayerPlugin interface
Throws
IllegalArgumentException
IllegalStateException

public void startAdBreak ()

Will start the waiting ad break, if any. To use only if you have disable the adbreak autoplay. Warnings: if you do not call this method, the ad break will never start and the SDK will be paused waiting for this method call. More information in the official documentation.