public class ImaPlayer
extends java.lang.Object
Constructor and Description |
---|
ImaPlayer(android.app.Activity activity,
android.widget.FrameLayout container,
Video video) |
ImaPlayer(android.app.Activity activity,
android.widget.FrameLayout container,
Video video,
java.lang.String videoTitle) |
ImaPlayer(android.app.Activity activity,
android.widget.FrameLayout container,
Video video,
java.lang.String videoTitle,
com.google.ads.interactivemedia.v3.api.ImaSdkSettings sdkSettings,
java.lang.String adTagUrl) |
ImaPlayer(android.app.Activity activity,
android.widget.FrameLayout container,
Video video,
java.lang.String videoTitle,
com.google.ads.interactivemedia.v3.api.ImaSdkSettings sdkSettings,
java.lang.String adTagUrl,
PlaybackControlLayer.FullscreenCallback fullscreenCallback) |
ImaPlayer(android.app.Activity activity,
android.widget.FrameLayout container,
Video video,
java.lang.String videoTitle,
java.lang.String adTagUrl) |
Modifier and Type | Method and Description |
---|---|
void |
addActionButton(android.graphics.drawable.Drawable icon,
java.lang.String contentDescription,
android.view.View.OnClickListener onClickListener)
Creates a button to put in the top right of the video player.
|
void |
pause()
Pause video playback.
|
void |
play()
Resume video playback.
|
void |
release()
When you are finished using this
ImaPlayer , make sure to call this method. |
void |
setChromeColor(int color)
Sets the color of the top chrome, bottom chrome, and background.
|
void |
setFullscreenCallback(PlaybackControlLayer.FullscreenCallback fullscreenCallback)
Set the callback which will be called when the player enters and leaves fullscreen mode.
|
void |
setLogoImage(android.graphics.drawable.Drawable logo)
Set the logo with appears in the left of the top chrome.
|
void |
setPlaybackControlColor(int color)
Sets the color of the buttons and seek bar.
|
public ImaPlayer(android.app.Activity activity, android.widget.FrameLayout container, Video video, java.lang.String videoTitle, com.google.ads.interactivemedia.v3.api.ImaSdkSettings sdkSettings, java.lang.String adTagUrl, PlaybackControlLayer.FullscreenCallback fullscreenCallback)
activity
- The activity that will contain the video player.container
- The FrameLayout
which will contain the video player.video
- The video that should be played.videoTitle
- The title of the video (displayed on the left of the top chrome).sdkSettings
- The settings that should be used to configure the IMA SDK.adTagUrl
- The URL containing the VAST document of the ad.fullscreenCallback
- The callback that should be triggered when the player enters or
leaves fullscreen.public ImaPlayer(android.app.Activity activity, android.widget.FrameLayout container, Video video, java.lang.String videoTitle, com.google.ads.interactivemedia.v3.api.ImaSdkSettings sdkSettings, java.lang.String adTagUrl)
activity
- The activity that will contain the video player.container
- The FrameLayout
which will contain the video player.video
- The video that should be played.videoTitle
- The title of the video (displayed on the left of the top chrome).sdkSettings
- The settings that should be used to configure the IMA SDK.adTagUrl
- The URL containing the VAST document of the ad.public ImaPlayer(android.app.Activity activity, android.widget.FrameLayout container, Video video, java.lang.String videoTitle, java.lang.String adTagUrl)
activity
- The activity that will contain the video player.container
- The FrameLayout
which will contain the video player.video
- The video that should be played.videoTitle
- The title of the video (displayed on the left of the top chrome).adTagUrl
- The URL containing the VAST document of the ad.public ImaPlayer(android.app.Activity activity, android.widget.FrameLayout container, Video video, java.lang.String videoTitle)
activity
- The activity that will contain the video player.container
- The FrameLayout
which will contain the video player.video
- The video that should be played.videoTitle
- The title of the video (displayed on the left of the top chrome).public ImaPlayer(android.app.Activity activity, android.widget.FrameLayout container, Video video)
activity
- The activity that will contain the video player.container
- The FrameLayout
which will contain the video player.video
- The video that should be played.public void pause()
public void play()
public void setLogoImage(android.graphics.drawable.Drawable logo)
logo
- The drawable which will be the logo.public void setChromeColor(int color)
color
- a color derived from the @{link Color} class
(ex. Color.RED
).public void setPlaybackControlColor(int color)
color
- a color derived from the @{link Color} class
(ex. Color.RED
).public void addActionButton(android.graphics.drawable.Drawable icon, java.lang.String contentDescription, android.view.View.OnClickListener onClickListener)
icon
- The image of the action (ex. trash can).contentDescription
- The text description this action. This is used in case the
action buttons do not fit in the video player. If so, an overflow
button will appear and, when clicked, it will display a list of the
content descriptions for each action.onClickListener
- The handler for when the action is triggered.public void setFullscreenCallback(PlaybackControlLayer.FullscreenCallback fullscreenCallback)
fullscreenCallback
- The callback should hide other views in the activity when the player
enters fullscreen mode and show other views when the player leaves
fullscreen mode.public void release()
ImaPlayer
, make sure to call this method.