Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
88abe26e
authored
Oct 02, 2020
by
andrewlewis
Committed by
Oliver Woodman
Oct 17, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Allow apps to add a VideoAdPlayerCallback
Issue: #7944 PiperOrigin-RevId: 335012643
parent
13d88602
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
RELEASENOTES.md
extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.java
RELEASENOTES.md
View file @
88abe26e
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
*
IMA extension:
*
IMA extension:
*
Fix position reporting after fetch errors
*
Fix position reporting after fetch errors
(
[
#7956
](
https://github.com/google/ExoPlayer/issues/7956
)
).
(
[
#7956
](
https://github.com/google/ExoPlayer/issues/7956
)
).
*
Allow apps to specify a
`VideoAdPlayerCallback`
(
[
#7944
](
https://github.com/google/ExoPlayer/issues/7944
)
).
### 2.12.0 (2020-09-11) ###
### 2.12.0 (2020-09-11) ###
...
...
extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.java
View file @
88abe26e
...
@@ -125,6 +125,7 @@ public final class ImaAdsLoader
...
@@ -125,6 +125,7 @@ public final class ImaAdsLoader
@Nullable
private
ImaSdkSettings
imaSdkSettings
;
@Nullable
private
ImaSdkSettings
imaSdkSettings
;
@Nullable
private
AdErrorListener
adErrorListener
;
@Nullable
private
AdErrorListener
adErrorListener
;
@Nullable
private
AdEventListener
adEventListener
;
@Nullable
private
AdEventListener
adEventListener
;
@Nullable
private
VideoAdPlayer
.
VideoAdPlayerCallback
videoAdPlayerCallback
;
@Nullable
private
Set
<
UiElement
>
adUiElements
;
@Nullable
private
Set
<
UiElement
>
adUiElements
;
@Nullable
private
Collection
<
CompanionAdSlot
>
companionAdSlots
;
@Nullable
private
Collection
<
CompanionAdSlot
>
companionAdSlots
;
private
long
adPreloadTimeoutMs
;
private
long
adPreloadTimeoutMs
;
...
@@ -191,6 +192,22 @@ public final class ImaAdsLoader
...
@@ -191,6 +192,22 @@ public final class ImaAdsLoader
}
}
/**
/**
* Sets a callback to receive video ad player events. Note that these events are handled
* internally by the IMA SDK and this ads loader. For analytics and diagnostics, new
* implementations should generally use events from the top-level {@link Player} listeners
* instead of setting a callback via this method.
*
* @param videoAdPlayerCallback The callback to receive video ad player events.
* @return This builder, for convenience.
* @see com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback
*/
public
Builder
setVideoAdPlayerCallback
(
VideoAdPlayer
.
VideoAdPlayerCallback
videoAdPlayerCallback
)
{
this
.
videoAdPlayerCallback
=
checkNotNull
(
videoAdPlayerCallback
);
return
this
;
}
/**
* Sets the ad UI elements to be rendered by the IMA SDK.
* Sets the ad UI elements to be rendered by the IMA SDK.
*
*
* @param adUiElements The ad UI elements to be rendered by the IMA SDK.
* @param adUiElements The ad UI elements to be rendered by the IMA SDK.
...
@@ -524,6 +541,9 @@ public final class ImaAdsLoader
...
@@ -524,6 +541,9 @@ public final class ImaAdsLoader
handler
=
Util
.
createHandler
(
getImaLooper
(),
/* callback= */
null
);
handler
=
Util
.
createHandler
(
getImaLooper
(),
/* callback= */
null
);
componentListener
=
new
ComponentListener
();
componentListener
=
new
ComponentListener
();
adCallbacks
=
new
ArrayList
<>(
/* initialCapacity= */
1
);
adCallbacks
=
new
ArrayList
<>(
/* initialCapacity= */
1
);
if
(
builder
.
videoAdPlayerCallback
!=
null
)
{
adCallbacks
.
add
(
builder
.
videoAdPlayerCallback
);
}
updateAdProgressRunnable
=
this
::
updateAdProgress
;
updateAdProgressRunnable
=
this
::
updateAdProgress
;
adInfoByAdMediaInfo
=
HashBiMap
.
create
();
adInfoByAdMediaInfo
=
HashBiMap
.
create
();
supportedMimeTypes
=
Collections
.
emptyList
();
supportedMimeTypes
=
Collections
.
emptyList
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment