mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
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;
|
||||
|
||||
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.checkNotNull;
|
||||
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. */
|
||||
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. */
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@ -1661,12 +1661,6 @@ public final class ImaAdsLoader
|
||||
: 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) {
|
||||
int count = adGroupTimesUs.length;
|
||||
if (count == 1) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
package com.google.android.exoplayer2.ext.ima;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
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
|
||||
* OverlayInfo#purpose}.
|
||||
@ -203,6 +207,13 @@ import java.util.Set;
|
||||
|| 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. */
|
||||
public static String getStringForVideoProgressUpdate(VideoProgressUpdate videoProgressUpdate) {
|
||||
if (VideoProgressUpdate.VIDEO_TIME_NOT_READY.equals(videoProgressUpdate)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user