com.google.android.exoplayer2.source.ads.AdPlaybackState Java Examples

The following examples show how to use com.google.android.exoplayer2.source.ads.AdPlaybackState. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Timeline.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets the data held by this period.
 *
 * @param id An identifier for the period. Not necessarily unique.
 * @param uid A unique identifier for the period.
 * @param windowIndex The index of the window to which this period belongs.
 * @param durationUs The duration of this period in microseconds, or {@link C#TIME_UNSET} if
 *     unknown.
 * @param positionInWindowUs The position of the start of this period relative to the start of
 *     the window to which it belongs, in milliseconds. May be negative if the start of the
 *     period is not within the window.
 * @param adPlaybackState The state of the period's ads, or {@link AdPlaybackState#NONE} if
 *     there are no ads.
 * @return This period, for convenience.
 */
public Period set(
    Object id,
    Object uid,
    int windowIndex,
    long durationUs,
    long positionInWindowUs,
    AdPlaybackState adPlaybackState) {
  this.id = id;
  this.uid = uid;
  this.windowIndex = windowIndex;
  this.durationUs = durationUs;
  this.positionInWindowUs = positionInWindowUs;
  this.adPlaybackState = adPlaybackState;
  return this;
}
 
Example #2
Source File: Timeline.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets the data held by this period.
 *
 * @param id An identifier for the period. Not necessarily unique.
 * @param uid A unique identifier for the period.
 * @param windowIndex The index of the window to which this period belongs.
 * @param durationUs The duration of this period in microseconds, or {@link C#TIME_UNSET} if
 *     unknown.
 * @param positionInWindowUs The position of the start of this period relative to the start of
 *     the window to which it belongs, in milliseconds. May be negative if the start of the
 *     period is not within the window.
 * @param adPlaybackState The state of the period's ads, or {@link AdPlaybackState#NONE} if
 *     there are no ads.
 * @return This period, for convenience.
 */
public Period set(
    Object id,
    Object uid,
    int windowIndex,
    long durationUs,
    long positionInWindowUs,
    AdPlaybackState adPlaybackState) {
  this.id = id;
  this.uid = uid;
  this.windowIndex = windowIndex;
  this.durationUs = durationUs;
  this.positionInWindowUs = positionInWindowUs;
  this.adPlaybackState = adPlaybackState;
  return this;
}
 
Example #3
Source File: Timeline.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the data held by this period.
 *
 * @param id An identifier for the period. Not necessarily unique. May be null if the ids of the
 *     period are not required.
 * @param uid A unique identifier for the period. May be null if the ids of the period are not
 *     required.
 * @param windowIndex The index of the window to which this period belongs.
 * @param durationUs The duration of this period in microseconds, or {@link C#TIME_UNSET} if
 *     unknown.
 * @param positionInWindowUs The position of the start of this period relative to the start of
 *     the window to which it belongs, in milliseconds. May be negative if the start of the
 *     period is not within the window.
 * @param adPlaybackState The state of the period's ads, or {@link AdPlaybackState#NONE} if
 *     there are no ads.
 * @return This period, for convenience.
 */
public Period set(
    @Nullable Object id,
    @Nullable Object uid,
    int windowIndex,
    long durationUs,
    long positionInWindowUs,
    AdPlaybackState adPlaybackState) {
  this.id = id;
  this.uid = uid;
  this.windowIndex = windowIndex;
  this.durationUs = durationUs;
  this.positionInWindowUs = positionInWindowUs;
  this.adPlaybackState = adPlaybackState;
  return this;
}
 
Example #4
Source File: Timeline.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
/** Creates a new instance with no ad playback state. */
public Period() {
  adPlaybackState = AdPlaybackState.NONE;
}
 
Example #5
Source File: Timeline.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the data held by this period.
 *
 * @param id An identifier for the period. Not necessarily unique. May be null if the ids of the
 *     period are not required.
 * @param uid A unique identifier for the period. May be null if the ids of the period are not
 *     required.
 * @param windowIndex The index of the window to which this period belongs.
 * @param durationUs The duration of this period in microseconds, or {@link C#TIME_UNSET} if
 *     unknown.
 * @param positionInWindowUs The position of the start of this period relative to the start of
 *     the window to which it belongs, in milliseconds. May be negative if the start of the
 *     period is not within the window.
 * @param adPlaybackState The state of the period's ads, or {@link AdPlaybackState#NONE} if
 *     there are no ads.
 * @return This period, for convenience.
 */
public Period set(
    @Nullable Object id,
    @Nullable Object uid,
    int windowIndex,
    long durationUs,
    long positionInWindowUs,
    AdPlaybackState adPlaybackState) {
  this.id = id;
  this.uid = uid;
  this.windowIndex = windowIndex;
  this.durationUs = durationUs;
  this.positionInWindowUs = positionInWindowUs;
  this.adPlaybackState = adPlaybackState;
  return this;
}
 
Example #6
Source File: Timeline.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
/** Creates a new instance with no ad playback state. */
public Period() {
  adPlaybackState = AdPlaybackState.NONE;
}
 
Example #7
Source File: Timeline.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the data held by this period.
 *
 * @param id An identifier for the period. Not necessarily unique. May be null if the ids of the
 *     period are not required.
 * @param uid A unique identifier for the period. May be null if the ids of the period are not
 *     required.
 * @param windowIndex The index of the window to which this period belongs.
 * @param durationUs The duration of this period in microseconds, or {@link C#TIME_UNSET} if
 *     unknown.
 * @param positionInWindowUs The position of the start of this period relative to the start of
 *     the window to which it belongs, in milliseconds. May be negative if the start of the
 *     period is not within the window.
 * @param adPlaybackState The state of the period's ads, or {@link AdPlaybackState#NONE} if
 *     there are no ads.
 * @return This period, for convenience.
 */
public Period set(
    @Nullable Object id,
    @Nullable Object uid,
    int windowIndex,
    long durationUs,
    long positionInWindowUs,
    AdPlaybackState adPlaybackState) {
  this.id = id;
  this.uid = uid;
  this.windowIndex = windowIndex;
  this.durationUs = durationUs;
  this.positionInWindowUs = positionInWindowUs;
  this.adPlaybackState = adPlaybackState;
  return this;
}
 
Example #8
Source File: Timeline.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
/** Creates a new instance with no ad playback state. */
public Period() {
  adPlaybackState = AdPlaybackState.NONE;
}
 
Example #9
Source File: Timeline.java    From MediaSDK with Apache License 2.0 3 votes vote down vote up
/**
 * Sets the data held by this period.
 *
 * @param id An identifier for the period. Not necessarily unique. May be null if the ids of the
 *     period are not required.
 * @param uid A unique identifier for the period. May be null if the ids of the period are not
 *     required.
 * @param windowIndex The index of the window to which this period belongs.
 * @param durationUs The duration of this period in microseconds, or {@link C#TIME_UNSET} if
 *     unknown.
 * @param positionInWindowUs The position of the start of this period relative to the start of
 *     the window to which it belongs, in milliseconds. May be negative if the start of the
 *     period is not within the window.
 * @return This period, for convenience.
 */
public Period set(
    @Nullable Object id,
    @Nullable Object uid,
    int windowIndex,
    long durationUs,
    long positionInWindowUs) {
  return set(id, uid, windowIndex, durationUs, positionInWindowUs, AdPlaybackState.NONE);
}
 
Example #10
Source File: Timeline.java    From Telegram with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the data held by this period.
 *
 * @param id An identifier for the period. Not necessarily unique. May be null if the ids of the
 *     period are not required.
 * @param uid A unique identifier for the period. May be null if the ids of the period are not
 *     required.
 * @param windowIndex The index of the window to which this period belongs.
 * @param durationUs The duration of this period in microseconds, or {@link C#TIME_UNSET} if
 *     unknown.
 * @param positionInWindowUs The position of the start of this period relative to the start of
 *     the window to which it belongs, in milliseconds. May be negative if the start of the
 *     period is not within the window.
 * @return This period, for convenience.
 */
public Period set(
    @Nullable Object id,
    @Nullable Object uid,
    int windowIndex,
    long durationUs,
    long positionInWindowUs) {
  return set(id, uid, windowIndex, durationUs, positionInWindowUs, AdPlaybackState.NONE);
}
 
Example #11
Source File: Timeline.java    From Telegram-FOSS with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the data held by this period.
 *
 * @param id An identifier for the period. Not necessarily unique. May be null if the ids of the
 *     period are not required.
 * @param uid A unique identifier for the period. May be null if the ids of the period are not
 *     required.
 * @param windowIndex The index of the window to which this period belongs.
 * @param durationUs The duration of this period in microseconds, or {@link C#TIME_UNSET} if
 *     unknown.
 * @param positionInWindowUs The position of the start of this period relative to the start of
 *     the window to which it belongs, in milliseconds. May be negative if the start of the
 *     period is not within the window.
 * @return This period, for convenience.
 */
public Period set(
    @Nullable Object id,
    @Nullable Object uid,
    int windowIndex,
    long durationUs,
    long positionInWindowUs) {
  return set(id, uid, windowIndex, durationUs, positionInWindowUs, AdPlaybackState.NONE);
}
 
Example #12
Source File: Timeline.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the duration of the ad at index {@code adIndexInAdGroup} in the ad group at
 * {@code adGroupIndex}, in microseconds, or {@link C#TIME_UNSET} if not yet known.
 *
 * @param adGroupIndex The ad group index.
 * @param adIndexInAdGroup The ad index in the ad group.
 * @return The duration of the ad, or {@link C#TIME_UNSET} if not yet known.
 */
public long getAdDurationUs(int adGroupIndex, int adIndexInAdGroup) {
  AdPlaybackState.AdGroup adGroup = adPlaybackState.adGroups[adGroupIndex];
  return adGroup.count != C.LENGTH_UNSET ? adGroup.durationsUs[adIndexInAdGroup] : C.TIME_UNSET;
}
 
Example #13
Source File: Timeline.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns whether the URL for the specified ad is known.
 *
 * @param adGroupIndex The ad group index.
 * @param adIndexInAdGroup The ad index in the ad group.
 * @return Whether the URL for the specified ad is known.
 */
public boolean isAdAvailable(int adGroupIndex, int adIndexInAdGroup) {
  AdPlaybackState.AdGroup adGroup = adPlaybackState.adGroups[adGroupIndex];
  return adGroup.count != C.LENGTH_UNSET
      && adGroup.states[adIndexInAdGroup] != AdPlaybackState.AD_STATE_UNAVAILABLE;
}
 
Example #14
Source File: Timeline.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the duration of the ad at index {@code adIndexInAdGroup} in the ad group at
 * {@code adGroupIndex}, in microseconds, or {@link C#TIME_UNSET} if not yet known.
 *
 * @param adGroupIndex The ad group index.
 * @param adIndexInAdGroup The ad index in the ad group.
 * @return The duration of the ad, or {@link C#TIME_UNSET} if not yet known.
 */
public long getAdDurationUs(int adGroupIndex, int adIndexInAdGroup) {
  AdPlaybackState.AdGroup adGroup = adPlaybackState.adGroups[adGroupIndex];
  return adGroup.count != C.LENGTH_UNSET ? adGroup.durationsUs[adIndexInAdGroup] : C.TIME_UNSET;
}
 
Example #15
Source File: Timeline.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns whether the URL for the specified ad is known.
 *
 * @param adGroupIndex The ad group index.
 * @param adIndexInAdGroup The ad index in the ad group.
 * @return Whether the URL for the specified ad is known.
 */
public boolean isAdAvailable(int adGroupIndex, int adIndexInAdGroup) {
  AdPlaybackState.AdGroup adGroup = adPlaybackState.adGroups[adGroupIndex];
  return adGroup.count != C.LENGTH_UNSET
      && adGroup.states[adIndexInAdGroup] != AdPlaybackState.AD_STATE_UNAVAILABLE;
}
 
Example #16
Source File: Timeline.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the duration of the ad at index {@code adIndexInAdGroup} in the ad group at
 * {@code adGroupIndex}, in microseconds, or {@link C#TIME_UNSET} if not yet known.
 *
 * @param adGroupIndex The ad group index.
 * @param adIndexInAdGroup The ad index in the ad group.
 * @return The duration of the ad, or {@link C#TIME_UNSET} if not yet known.
 */
public long getAdDurationUs(int adGroupIndex, int adIndexInAdGroup) {
  AdPlaybackState.AdGroup adGroup = adPlaybackState.adGroups[adGroupIndex];
  return adGroup.count != C.LENGTH_UNSET ? adGroup.durationsUs[adIndexInAdGroup] : C.TIME_UNSET;
}
 
Example #17
Source File: Timeline.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns whether the URL for the specified ad is known.
 *
 * @param adGroupIndex The ad group index.
 * @param adIndexInAdGroup The ad index in the ad group.
 * @return Whether the URL for the specified ad is known.
 */
public boolean isAdAvailable(int adGroupIndex, int adIndexInAdGroup) {
  AdPlaybackState.AdGroup adGroup = adPlaybackState.adGroups[adGroupIndex];
  return adGroup.count != C.LENGTH_UNSET
      && adGroup.states[adIndexInAdGroup] != AdPlaybackState.AD_STATE_UNAVAILABLE;
}
 
Example #18
Source File: Timeline.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the data held by this period.
 *
 * @param id An identifier for the period. Not necessarily unique.
 * @param uid A unique identifier for the period.
 * @param windowIndex The index of the window to which this period belongs.
 * @param durationUs The duration of this period in microseconds, or {@link C#TIME_UNSET} if
 *     unknown.
 * @param positionInWindowUs The position of the start of this period relative to the start of
 *     the window to which it belongs, in milliseconds. May be negative if the start of the
 *     period is not within the window.
 * @return This period, for convenience.
 */
public Period set(Object id, Object uid, int windowIndex, long durationUs,
    long positionInWindowUs) {
  return set(id, uid, windowIndex, durationUs, positionInWindowUs, AdPlaybackState.NONE);
}
 
Example #19
Source File: Timeline.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the duration of the ad at index {@code adIndexInAdGroup} in the ad group at
 * {@code adGroupIndex}, in microseconds, or {@link C#TIME_UNSET} if not yet known.
 *
 * @param adGroupIndex The ad group index.
 * @param adIndexInAdGroup The ad index in the ad group.
 * @return The duration of the ad, or {@link C#TIME_UNSET} if not yet known.
 */
public long getAdDurationUs(int adGroupIndex, int adIndexInAdGroup) {
  AdPlaybackState.AdGroup adGroup = adPlaybackState.adGroups[adGroupIndex];
  return adGroup.count != C.LENGTH_UNSET ? adGroup.durationsUs[adIndexInAdGroup] : C.TIME_UNSET;
}
 
Example #20
Source File: Timeline.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns whether the URL for the specified ad is known.
 *
 * @param adGroupIndex The ad group index.
 * @param adIndexInAdGroup The ad index in the ad group.
 * @return Whether the URL for the specified ad is known.
 */
public boolean isAdAvailable(int adGroupIndex, int adIndexInAdGroup) {
  AdPlaybackState.AdGroup adGroup = adPlaybackState.adGroups[adGroupIndex];
  return adGroup.count != C.LENGTH_UNSET
      && adGroup.states[adIndexInAdGroup] != AdPlaybackState.AD_STATE_UNAVAILABLE;
}
 
Example #21
Source File: Timeline.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the data held by this period.
 *
 * @param id An identifier for the period. Not necessarily unique.
 * @param uid A unique identifier for the period.
 * @param windowIndex The index of the window to which this period belongs.
 * @param durationUs The duration of this period in microseconds, or {@link C#TIME_UNSET} if
 *     unknown.
 * @param positionInWindowUs The position of the start of this period relative to the start of
 *     the window to which it belongs, in milliseconds. May be negative if the start of the
 *     period is not within the window.
 * @return This period, for convenience.
 */
public Period set(Object id, Object uid, int windowIndex, long durationUs,
    long positionInWindowUs) {
  return set(id, uid, windowIndex, durationUs, positionInWindowUs, AdPlaybackState.NONE);
}
 
Example #22
Source File: Timeline.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the duration of the ad at index {@code adIndexInAdGroup} in the ad group at
 * {@code adGroupIndex}, in microseconds, or {@link C#TIME_UNSET} if not yet known.
 *
 * @param adGroupIndex The ad group index.
 * @param adIndexInAdGroup The ad index in the ad group.
 * @return The duration of the ad, or {@link C#TIME_UNSET} if not yet known.
 */
public long getAdDurationUs(int adGroupIndex, int adIndexInAdGroup) {
  AdPlaybackState.AdGroup adGroup = adPlaybackState.adGroups[adGroupIndex];
  return adGroup.count != C.LENGTH_UNSET ? adGroup.durationsUs[adIndexInAdGroup] : C.TIME_UNSET;
}
 
Example #23
Source File: Timeline.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Returns whether the URL for the specified ad is known.
 *
 * @param adGroupIndex The ad group index.
 * @param adIndexInAdGroup The ad index in the ad group.
 * @return Whether the URL for the specified ad is known.
 */
public boolean isAdAvailable(int adGroupIndex, int adIndexInAdGroup) {
  AdPlaybackState.AdGroup adGroup = adPlaybackState.adGroups[adGroupIndex];
  return adGroup.count != C.LENGTH_UNSET
      && adGroup.states[adIndexInAdGroup] != AdPlaybackState.AD_STATE_UNAVAILABLE;
}