Move more IMA extension utils into ImaUtil
These symbols will be referenced from AdTagLoader too in a later change. PiperOrigin-RevId: 339889990
This commit is contained in:
parent
9962cf015b
commit
df19725d58
@ -15,6 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.exoplayer2.ext.ima;
|
package com.google.android.exoplayer2.ext.ima;
|
||||||
|
|
||||||
|
import static com.google.android.exoplayer2.ext.ima.ImaUtil.BITRATE_UNSET;
|
||||||
|
import static com.google.android.exoplayer2.ext.ima.ImaUtil.TIMEOUT_UNSET;
|
||||||
|
import static com.google.android.exoplayer2.ext.ima.ImaUtil.getImaLooper;
|
||||||
import static com.google.android.exoplayer2.util.Assertions.checkArgument;
|
import static com.google.android.exoplayer2.util.Assertions.checkArgument;
|
||||||
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
|
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
|
||||||
import static com.google.android.exoplayer2.util.Assertions.checkState;
|
import static com.google.android.exoplayer2.util.Assertions.checkState;
|
||||||
@ -461,9 +464,6 @@ public final class ImaAdsLoader
|
|||||||
/** The threshold below which ad cue points are treated as matching, in microseconds. */
|
/** The threshold below which ad cue points are treated as matching, in microseconds. */
|
||||||
private static final long THRESHOLD_AD_MATCH_US = 1000;
|
private static final long THRESHOLD_AD_MATCH_US = 1000;
|
||||||
|
|
||||||
private static final int TIMEOUT_UNSET = -1;
|
|
||||||
private static final int BITRATE_UNSET = -1;
|
|
||||||
|
|
||||||
/** The state of ad playback. */
|
/** The state of ad playback. */
|
||||||
@Documented
|
@Documented
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@ -1661,12 +1661,6 @@ public final class ImaAdsLoader
|
|||||||
: timeline.getPeriod(/* periodIndex= */ 0, period).getPositionInWindowMs());
|
: timeline.getPeriod(/* periodIndex= */ 0, period).getPositionInWindowMs());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Looper getImaLooper() {
|
|
||||||
// IMA SDK callbacks occur on the main thread. This method can be used to check that the player
|
|
||||||
// is using the same looper, to ensure all interaction with this class is on the main thread.
|
|
||||||
return Looper.getMainLooper();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean hasMidrollAdGroups(long[] adGroupTimesUs) {
|
private static boolean hasMidrollAdGroups(long[] adGroupTimesUs) {
|
||||||
int count = adGroupTimesUs.length;
|
int count = adGroupTimesUs.length;
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
package com.google.android.exoplayer2.ext.ima;
|
package com.google.android.exoplayer2.ext.ima;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Looper;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@ -130,6 +131,9 @@ import java.util.Set;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final int TIMEOUT_UNSET = -1;
|
||||||
|
public static final int BITRATE_UNSET = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the IMA {@link FriendlyObstructionPurpose} corresponding to the given {@link
|
* Returns the IMA {@link FriendlyObstructionPurpose} corresponding to the given {@link
|
||||||
* OverlayInfo#purpose}.
|
* OverlayInfo#purpose}.
|
||||||
@ -203,6 +207,13 @@ import java.util.Set;
|
|||||||
|| adError.getErrorCode() == AdError.AdErrorCode.UNKNOWN_ERROR;
|
|| adError.getErrorCode() == AdError.AdErrorCode.UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the looper on which all IMA SDK interaction must occur. */
|
||||||
|
public static Looper getImaLooper() {
|
||||||
|
// IMA SDK callbacks occur on the main thread. This method can be used to check that the player
|
||||||
|
// is using the same looper, to ensure all interaction with this class is on the main thread.
|
||||||
|
return Looper.getMainLooper();
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns a human-readable representation of a video progress update. */
|
/** Returns a human-readable representation of a video progress update. */
|
||||||
public static String getStringForVideoProgressUpdate(VideoProgressUpdate videoProgressUpdate) {
|
public static String getStringForVideoProgressUpdate(VideoProgressUpdate videoProgressUpdate) {
|
||||||
if (VideoProgressUpdate.VIDEO_TIME_NOT_READY.equals(videoProgressUpdate)) {
|
if (VideoProgressUpdate.VIDEO_TIME_NOT_READY.equals(videoProgressUpdate)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user