@Emits(events={"didSetSource","play","registerPlugin","didLoadAdManager","freewheelDidSubmitAdRequest","freewheelLock","freewheelShowDisplayAd","freewheelUnlock","freewheelWillSubmitAdRequest"}) @ListensFor(events={"adBreakCompleted","completed","didPause","didPlay","didSetSource","stop","videoDurationChanged","didLoadAdManager","freewheelLock","freewheelUnlock","freewheelWillSubmitAdRequest"}) public class FreeWheelController extends AbstractComponent
The FreeWheelController is responsible for managing the lifecycle of a Freewheel Ad sequence and fitting it within the context of the Brightcove Android SDK, by hooking into the BC Event system. It instantiates and controls a default instance of FreeWheel's AdManager, AdContext, each populated with default values. In addition, the FreeWheelController manages an instance of AdCuePointComponent (responsible for generating CuePoints from the AdContext and executing ad playback)
When we mention 'default values', we refer the developer to the FreeWheel documentation for their various classes. As described below, one of the design goals for this class is to provide a developer with access to the FreeWheel components. One can supply their own AdManager instance, or set the values on an AdContext before an AdRequest is made.
The FreeWheelController listens for several key events in the video playback lifecycle of the Brightcove Android sdk. End developers that wish to edit the AdContext before it is emitted should listen for the FreeWheelEventType.WILL_SUBMIT_AD_REQUEST event, and access the current context (or set it) via the AD_CONTEXT_KEY.
A few important details to note when using the FreeWheelController:
freeWheelController = new FreeWheelController(this, bcVideoView, eventEmitter); //configure your own IAdManager or supply connection information freeWheelController.setAdURL("http://demo.v.fwmrm.net/"); freeWheelController.setAdNetworkId(90750); freeWheelController.setProfile("fw_tutorial_android"); freeWheelController.setSiteSectionId("fw_tutorial_android"); freeWheelController.enable();
IAdContext
,
IAdManager
,
AdCuePointComponent
,
FreeWheelEventType
,
VideoDisplayComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AD_CONTEXT_KEY
Key used for storing the current
IAdContext in an Event |
static java.lang.String |
AD_REQUEST_CONFIGURATION_KEY
Key used for storing the current
AdRequestConfiguration in an Event |
static java.lang.String |
AD_SLOTS_KEY
Key used for storing a
List of ISlot instances for use by developers, e.g. |
eventEmitter, listenerTokens
Constructor and Description |
---|
FreeWheelController(android.app.Activity activity,
android.widget.FrameLayout frameLayout,
EventEmitter emitter) |
FreeWheelController(android.app.Activity activity,
android.widget.FrameLayout frameLayout,
EventEmitter emitter,
tv.freewheel.ad.interfaces.IAdManager manager) |
FreeWheelController(android.app.Activity activity,
android.view.SurfaceView surfaceView,
EventEmitter emitter)
Deprecated.
|
FreeWheelController(android.app.Activity activity,
android.view.SurfaceView surfaceView,
EventEmitter emitter,
tv.freewheel.ad.interfaces.IAdManager manager)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
disable()
Disables the plugin; prevents further event listening.
|
void |
enable()
Enables the FreeWheel plugin.
|
AdCuePointComponent |
getAdCuePointComponent() |
tv.freewheel.ad.interfaces.IAdManager |
getAdManager() |
tv.freewheel.ad.interfaces.IAdContext |
getCurrentContext() |
Video |
getCurrentVideo()
Allows access to the current Video object attached to the Controller, if any.
|
boolean |
isActive()
In order to listen in on the event system, the Controller needs to be enabled, after various settings (AdURL,
AdManagerURL, NetworkId, ProfileId, SiteSectionId) have been set.
|
boolean |
isAdRequestingEnabled()
Returns whether ad requesting is enabled.
|
void |
setAdManager(tv.freewheel.ad.interfaces.IAdManager manager) |
void |
setAdManagerURL(java.lang.String url)
Deprecated.
|
void |
setAdNetworkId(int id) |
void |
setAdRequestingEnabled(boolean value)
Sets the flag which controls whether ads are requested for new
videos.
|
void |
setAdURL(java.lang.String url) |
void |
setProfile(java.lang.String profile) |
void |
setSiteSectionId(java.lang.String sectionId) |
void |
setSubmissionTimeout(double timeout) |
void |
setupContext()
Creates a new AdContext, which can be used to enable ad
playback when replaying a video.
|
addListener, addOnceListener, getEventEmitter, removeListener, removeListeners
public static final java.lang.String AD_CONTEXT_KEY
IAdContext
in an Eventpublic static final java.lang.String AD_SLOTS_KEY
List
of ISlot
instances for use by developers, e.g. with DISPLAY ad typespublic static final java.lang.String AD_REQUEST_CONFIGURATION_KEY
AdRequestConfiguration
in an Eventpublic FreeWheelController(android.app.Activity activity, android.widget.FrameLayout frameLayout, EventEmitter emitter)
public FreeWheelController(android.app.Activity activity, android.widget.FrameLayout frameLayout, EventEmitter emitter, tv.freewheel.ad.interfaces.IAdManager manager)
@Deprecated public FreeWheelController(android.app.Activity activity, android.view.SurfaceView surfaceView, EventEmitter emitter)
@Deprecated public FreeWheelController(android.app.Activity activity, android.view.SurfaceView surfaceView, EventEmitter emitter, tv.freewheel.ad.interfaces.IAdManager manager)
public void setSubmissionTimeout(double timeout)
public void setAdManager(tv.freewheel.ad.interfaces.IAdManager manager)
public tv.freewheel.ad.interfaces.IAdManager getAdManager()
@Deprecated public void setAdManagerURL(java.lang.String url)
public void setAdURL(java.lang.String url)
public void setAdNetworkId(int id)
public void setProfile(java.lang.String profile)
public void setSiteSectionId(java.lang.String sectionId)
public Video getCurrentVideo()
Video
,
IAdContext
public tv.freewheel.ad.interfaces.IAdContext getCurrentContext()
IAdContext
public AdCuePointComponent getAdCuePointComponent()
public void enable()
public void disable()
public boolean isActive()
public void setAdRequestingEnabled(boolean value)
public boolean isAdRequestingEnabled()
public void setupContext()