Android SDK Version
- AbstractAdListener
- Ad
- AdChoicesView
- AdError
- AdIconView
- AdListener
- AdOptionsView
- AdOptionsView.Orientation
- AdSettings
- AdSettings.IntegrationErrorMode
- AdSettings.MultiprocessSupportMode
- AdSettings.TestAdType
- AdSize
- AdView
- AudienceNetworkActivity
- AudienceNetworkAds
- AudienceNetworkAds.AdFormat
- AudienceNetworkAds.InitListener
- AudienceNetworkAds.InitResult
- AudienceNetworkAds.InitSettingsBuilder
- BidderTokenProvider
- CacheFlag
- DefaultMediaViewVideoRenderer
- ExtraHints
- ExtraHints.Builder
- ExtraHints.HintType
- ExtraHints.Keyword
- InstreamVideoAdListener
- InstreamVideoAdView
- InterstitialAd
- InterstitialAdExtendedListener
- InterstitialAdListener
- MediaView
- MediaViewListener
- MediaViewVideoRenderer
- MediaViewVideoRendererWithBackgroundPlayback
- NativeAd
- NativeAd.AdCreativeType
- NativeAdBase
- NativeAdBase.Image
- NativeAdBase.MediaCacheFlag
- NativeAdBase.NativeComponentTag
- NativeAdBase.Rating
- NativeAdLayout
- NativeAdListener
- NativeAdScrollView
- NativeAdScrollView.AdViewProvider
- NativeAdsManager
- NativeAdsManager.Listener
- NativeAdView
- NativeAdView.Type
- NativeAdViewAttributes
- NativeBannerAd
- NativeBannerAdView
- NativeBannerAdView.Type
- RewardData
- RewardedVideoAd
- RewardedVideoAdExtendedListener
- RewardedVideoAdListener
- S2SRewardedVideoAdExtendedListener
- S2SRewardedVideoAdListener
- VideoAutoplayBehavior
- VideoStartReason
- java.lang.Object
- FrameLayout
- com.facebook.ads.internal.api.AdComponentView
- com.facebook.ads.MediaViewVideoRenderer
Direct Known Subclasses:
public abstract class MediaViewVideoRenderer
extends com.facebook.ads.internal.api.AdComponentView
Abstract video renderer class that developers can extend to implement very customized video UI within the MediaView.
Since:
4.28
Field Summary
Modifier and Type | Field and Description |
---|---|
protected NativeAd | nativeAd Deprecated. |
protected VideoAutoplayBehavior | videoAutoplayBehavior Deprecated. |
Constructor Summary
Constructor and Description |
---|
MediaViewVideoRenderer(Context context) |
MediaViewVideoRenderer(Context context, AttributeSet attrs) |
MediaViewVideoRenderer(Context context, AttributeSet attrs, int defStyleAttr) |
MediaViewVideoRenderer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) |
Method Summary
Modifier and Type | Method and Description |
---|---|
void | addView(View child) |
void | addView(View child, int index) |
void | addView(View child, int width, int height) |
void | addView(View child, int index, ViewGroup.LayoutParams params) |
void | addView(View child, ViewGroup.LayoutParams params) |
void | destroy() Deprecated. |
void | disengageSeek(VideoStartReason startReason) Take the video out of seek mode. |
void | engageSeek() Used to put the video into seek mode. |
int | getCurrentTimeMs() Get the current playback position in milliseconds. |
int | getDuration() Get the duration of the video in milliseconds. |
com.facebook.ads.internal.api.MediaViewVideoRendererApi | getMediaViewVideoRendererApi() Used by other SDK classes and subject to change. |
float | getVolume() Get the volume of the video player. |
void | onCompleted() Callback when the video has completed playing. |
void | onError() Callback when the video had an error during initialization or playback. |
void | onPaused() Callback when the video has been paused. |
void | onPlayed() Callback when the video has started playing. |
void | onPrepared() Callback when the video is prepared and ready to play. |
void | onSeek() Callback when the video is seeked. |
void | onSeekDisengaged() Callback when seek mode is disengaged. |
void | onSeekEngaged() Callback when seek mode is engaged. |
void | onVolumeChanged() Callback when the volume of the video has changed. |
void | pause(boolean pausedByUser) Stop video playback. |
void | play(VideoStartReason startReason) Start video playback. |
void | seekTo(int timeMs) Set the seek position in milliseconds. |
void | setNativeAd(NativeAd nativeAd) Deprecated. since 5.2 |
void | setVolume(float volume) Set the volume of the video player. |
boolean | shouldAllowBackgroundPlayback() Whether background video playback should be enabled or not. |
boolean | shouldAutoplay() Returns if the video should autoplay or not. |
void | unsetNativeAd() Deprecated. since 5.2 |
Constructor Detail
MediaViewVideoRenderer
public MediaViewVideoRenderer(Context context)
MediaViewVideoRenderer
public MediaViewVideoRenderer(Context context, AttributeSet attrs)
MediaViewVideoRenderer
public MediaViewVideoRenderer(Context context, AttributeSet attrs, int defStyleAttr)
MediaViewVideoRenderer
public MediaViewVideoRenderer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Method Detail
getMediaViewVideoRendererApi
public com.facebook.ads.internal.api.MediaViewVideoRendererApi getMediaViewVideoRendererApi()
Used by other SDK classes and subject to change.
setNativeAd
@Deprecated public void setNativeAd(NativeAd nativeAd)
Deprecated. since 5.2
Load the MediaView with a NativeAd.
Parameters:
nativeAd
- NativeAd to loadSince:
4.28
unsetNativeAd
@Deprecated public void unsetNativeAd()
Deprecated. since 5.2
Unload the MediaView. It is possible to reuse the same MediaView with different NativeAd objects to avoid unnecessary inflation steps.
Since:
4.28
play
public final void play(VideoStartReason startReason)
Start video playback.
Parameters:
startReason
- Whether this video play was triggered by user or an automatic mechanism.Since:
4.28
pause
public final void pause(boolean pausedByUser)
Stop video playback.
Since:
4.28
getCurrentTimeMs
public final int getCurrentTimeMs()
Get the current playback position in milliseconds.
Returns:
int value representing current playback position in milliseconds.
Since:
4.28
engageSeek
public final void engageSeek()
Used to put the video into seek mode. Video playback halts, and one or more calls to seekTo can be made before calling disengageVideoSeek.
Since:
4.28
disengageSeek
public final void disengageSeek(VideoStartReason startReason)
Take the video out of seek mode.
Parameters:
startReason
- Playback may resume after disengaging seek and we need to know whether this was triggered by user or an automatic mechanism for proper watch time attribution.Since:
4.28
seekTo
public final void seekTo(int timeMs)
Set the seek position in milliseconds. Only works after calling engageSeek.
Parameters:
timeMs
- int value representing the position in millisecondsSince:
4.28
getDuration
public final int getDuration()
Get the duration of the video in milliseconds.
Returns:
int value representing the duration of the video in milliseconds.
Since:
4.28
setVolume
public final void setVolume(float volume)
Set the volume of the video player.
Parameters:
volume
- float value representing the volumeSince:
4.28
getVolume
public final float getVolume()
Get the volume of the video player.
Returns:
float value representing the volume
Since:
4.28
shouldAutoplay
public final boolean shouldAutoplay()
Returns if the video should autoplay or not. This SDK will determine whether autoplay should happen based on placement settings.
Returns:
true if this video should be autoplayed
destroy
@Deprecated public void destroy()
Deprecated.
onPrepared
public void onPrepared()
Callback when the video is prepared and ready to play.
Since:
4.28
onPlayed
public void onPlayed()
Callback when the video has started playing.
Since:
4.28
onPaused
public void onPaused()
Callback when the video has been paused.
Since:
4.28
onSeekEngaged
public void onSeekEngaged()
Callback when seek mode is engaged.
Since:
4.28
onSeek
public void onSeek()
Callback when the video is seeked.
Since:
4.28
onSeekDisengaged
public void onSeekDisengaged()
Callback when seek mode is disengaged.
Since:
4.28
onCompleted
public void onCompleted()
Callback when the video has completed playing.
Since:
4.28
onVolumeChanged
public void onVolumeChanged()
Callback when the volume of the video has changed.
Since:
4.28
onError
public void onError()
Callback when the video had an error during initialization or playback.
Since:
4.28
shouldAllowBackgroundPlayback
public boolean shouldAllowBackgroundPlayback()
Whether background video playback should be enabled or not. This will allow videos in Native Ads to keep playing sound when the video is off-screen. It will not work when the video is set to full screen mode. Override this and return true to enable background playback.
Returns:
true if background video playback is enabled, false otherwise
Since:
4.28
addView
public void addView(View child)
addView
public void addView(View child, int index)
addView
public void addView(View child, ViewGroup.LayoutParams params)
addView
public void addView(View child, int width, int height)
addView
public void addView(View child, int index, ViewGroup.LayoutParams params)