mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Let apps specify whether to focus skip button on ATV
Issue: #5019 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=219267048
This commit is contained in:
parent
e6b49a5410
commit
b007cbf2b4
2 changed files with 27 additions and 0 deletions
|
|
@ -26,6 +26,9 @@
|
||||||
([#4532](https://github.com/google/ExoPlayer/issues/4532)).
|
([#4532](https://github.com/google/ExoPlayer/issues/4532)).
|
||||||
* Suppress spurious "references unknown class member" shrinking warning
|
* Suppress spurious "references unknown class member" shrinking warning
|
||||||
([#4890](https://github.com/google/ExoPlayer/issues/4890)).
|
([#4890](https://github.com/google/ExoPlayer/issues/4890)).
|
||||||
|
* IMA extension:
|
||||||
|
* Let apps specify whether to focus the skip button on ATV
|
||||||
|
([#5019](https://github.com/google/ExoPlayer/issues/5019)).
|
||||||
* Fix issue where a `NullPointerException` is thrown when removing an unprepared
|
* Fix issue where a `NullPointerException` is thrown when removing an unprepared
|
||||||
media source from a `ConcatenatingMediaSource` with the `useLazyPreparation`
|
media source from a `ConcatenatingMediaSource` with the `useLazyPreparation`
|
||||||
option enabled ([#4986](https://github.com/google/ExoPlayer/issues/4986)).
|
option enabled ([#4986](https://github.com/google/ExoPlayer/issues/4986)).
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ public final class ImaAdsLoader
|
||||||
private @Nullable AdEventListener adEventListener;
|
private @Nullable AdEventListener adEventListener;
|
||||||
private int vastLoadTimeoutMs;
|
private int vastLoadTimeoutMs;
|
||||||
private int mediaLoadTimeoutMs;
|
private int mediaLoadTimeoutMs;
|
||||||
|
private boolean focusSkipButtonWhenAvailable;
|
||||||
private ImaFactory imaFactory;
|
private ImaFactory imaFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -104,6 +105,7 @@ public final class ImaAdsLoader
|
||||||
this.context = Assertions.checkNotNull(context);
|
this.context = Assertions.checkNotNull(context);
|
||||||
vastLoadTimeoutMs = TIMEOUT_UNSET;
|
vastLoadTimeoutMs = TIMEOUT_UNSET;
|
||||||
mediaLoadTimeoutMs = TIMEOUT_UNSET;
|
mediaLoadTimeoutMs = TIMEOUT_UNSET;
|
||||||
|
focusSkipButtonWhenAvailable = true;
|
||||||
imaFactory = new DefaultImaFactory();
|
imaFactory = new DefaultImaFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -159,6 +161,20 @@ public final class ImaAdsLoader
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether to focus the skip button (when available) on Android TV devices. The default
|
||||||
|
* setting is {@code true}.
|
||||||
|
*
|
||||||
|
* @param focusSkipButtonWhenAvailable Whether to focus the skip button (when available) on
|
||||||
|
* Android TV devices.
|
||||||
|
* @return This builder, for convenience.
|
||||||
|
* @see AdsRenderingSettings#setFocusSkipButtonWhenAvailable(boolean)
|
||||||
|
*/
|
||||||
|
public Builder setFocusSkipButtonWhenAvailable(boolean focusSkipButtonWhenAvailable) {
|
||||||
|
this.focusSkipButtonWhenAvailable = focusSkipButtonWhenAvailable;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
// @VisibleForTesting
|
// @VisibleForTesting
|
||||||
/* package */ Builder setImaFactory(ImaFactory imaFactory) {
|
/* package */ Builder setImaFactory(ImaFactory imaFactory) {
|
||||||
this.imaFactory = Assertions.checkNotNull(imaFactory);
|
this.imaFactory = Assertions.checkNotNull(imaFactory);
|
||||||
|
|
@ -181,6 +197,7 @@ public final class ImaAdsLoader
|
||||||
null,
|
null,
|
||||||
vastLoadTimeoutMs,
|
vastLoadTimeoutMs,
|
||||||
mediaLoadTimeoutMs,
|
mediaLoadTimeoutMs,
|
||||||
|
focusSkipButtonWhenAvailable,
|
||||||
adEventListener,
|
adEventListener,
|
||||||
imaFactory);
|
imaFactory);
|
||||||
}
|
}
|
||||||
|
|
@ -200,6 +217,7 @@ public final class ImaAdsLoader
|
||||||
adsResponse,
|
adsResponse,
|
||||||
vastLoadTimeoutMs,
|
vastLoadTimeoutMs,
|
||||||
mediaLoadTimeoutMs,
|
mediaLoadTimeoutMs,
|
||||||
|
focusSkipButtonWhenAvailable,
|
||||||
adEventListener,
|
adEventListener,
|
||||||
imaFactory);
|
imaFactory);
|
||||||
}
|
}
|
||||||
|
|
@ -252,6 +270,7 @@ public final class ImaAdsLoader
|
||||||
private final @Nullable String adsResponse;
|
private final @Nullable String adsResponse;
|
||||||
private final int vastLoadTimeoutMs;
|
private final int vastLoadTimeoutMs;
|
||||||
private final int mediaLoadTimeoutMs;
|
private final int mediaLoadTimeoutMs;
|
||||||
|
private final boolean focusSkipButtonWhenAvailable;
|
||||||
private final @Nullable AdEventListener adEventListener;
|
private final @Nullable AdEventListener adEventListener;
|
||||||
private final ImaFactory imaFactory;
|
private final ImaFactory imaFactory;
|
||||||
private final Timeline.Period period;
|
private final Timeline.Period period;
|
||||||
|
|
@ -338,6 +357,7 @@ public final class ImaAdsLoader
|
||||||
/* adsResponse= */ null,
|
/* adsResponse= */ null,
|
||||||
/* vastLoadTimeoutMs= */ TIMEOUT_UNSET,
|
/* vastLoadTimeoutMs= */ TIMEOUT_UNSET,
|
||||||
/* mediaLoadTimeoutMs= */ TIMEOUT_UNSET,
|
/* mediaLoadTimeoutMs= */ TIMEOUT_UNSET,
|
||||||
|
/* focusSkipButtonWhenAvailable= */ true,
|
||||||
/* adEventListener= */ null,
|
/* adEventListener= */ null,
|
||||||
/* imaFactory= */ new DefaultImaFactory());
|
/* imaFactory= */ new DefaultImaFactory());
|
||||||
}
|
}
|
||||||
|
|
@ -362,6 +382,7 @@ public final class ImaAdsLoader
|
||||||
/* adsResponse= */ null,
|
/* adsResponse= */ null,
|
||||||
/* vastLoadTimeoutMs= */ TIMEOUT_UNSET,
|
/* vastLoadTimeoutMs= */ TIMEOUT_UNSET,
|
||||||
/* mediaLoadTimeoutMs= */ TIMEOUT_UNSET,
|
/* mediaLoadTimeoutMs= */ TIMEOUT_UNSET,
|
||||||
|
/* focusSkipButtonWhenAvailable= */ true,
|
||||||
/* adEventListener= */ null,
|
/* adEventListener= */ null,
|
||||||
/* imaFactory= */ new DefaultImaFactory());
|
/* imaFactory= */ new DefaultImaFactory());
|
||||||
}
|
}
|
||||||
|
|
@ -373,6 +394,7 @@ public final class ImaAdsLoader
|
||||||
@Nullable String adsResponse,
|
@Nullable String adsResponse,
|
||||||
int vastLoadTimeoutMs,
|
int vastLoadTimeoutMs,
|
||||||
int mediaLoadTimeoutMs,
|
int mediaLoadTimeoutMs,
|
||||||
|
boolean focusSkipButtonWhenAvailable,
|
||||||
@Nullable AdEventListener adEventListener,
|
@Nullable AdEventListener adEventListener,
|
||||||
ImaFactory imaFactory) {
|
ImaFactory imaFactory) {
|
||||||
Assertions.checkArgument(adTagUri != null || adsResponse != null);
|
Assertions.checkArgument(adTagUri != null || adsResponse != null);
|
||||||
|
|
@ -380,6 +402,7 @@ public final class ImaAdsLoader
|
||||||
this.adsResponse = adsResponse;
|
this.adsResponse = adsResponse;
|
||||||
this.vastLoadTimeoutMs = vastLoadTimeoutMs;
|
this.vastLoadTimeoutMs = vastLoadTimeoutMs;
|
||||||
this.mediaLoadTimeoutMs = mediaLoadTimeoutMs;
|
this.mediaLoadTimeoutMs = mediaLoadTimeoutMs;
|
||||||
|
this.focusSkipButtonWhenAvailable = focusSkipButtonWhenAvailable;
|
||||||
this.adEventListener = adEventListener;
|
this.adEventListener = adEventListener;
|
||||||
this.imaFactory = imaFactory;
|
this.imaFactory = imaFactory;
|
||||||
if (imaSdkSettings == null) {
|
if (imaSdkSettings == null) {
|
||||||
|
|
@ -926,6 +949,7 @@ public final class ImaAdsLoader
|
||||||
if (mediaLoadTimeoutMs != TIMEOUT_UNSET) {
|
if (mediaLoadTimeoutMs != TIMEOUT_UNSET) {
|
||||||
adsRenderingSettings.setLoadVideoTimeout(mediaLoadTimeoutMs);
|
adsRenderingSettings.setLoadVideoTimeout(mediaLoadTimeoutMs);
|
||||||
}
|
}
|
||||||
|
adsRenderingSettings.setFocusSkipButtonWhenAvailable(focusSkipButtonWhenAvailable);
|
||||||
|
|
||||||
// Set up the ad playback state, skipping ads based on the start position as required.
|
// Set up the ad playback state, skipping ads based on the start position as required.
|
||||||
long[] adGroupTimesUs = getAdGroupTimesUs(adsManager.getAdCuePoints());
|
long[] adGroupTimesUs = getAdGroupTimesUs(adsManager.getAdCuePoints());
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue