Java Code Examples for com.google.android.exoplayer2.util.Clock#DEFAULT

The following examples show how to use com.google.android.exoplayer2.util.Clock#DEFAULT . 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: SimpleExoPlayer.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param renderersFactory A factory for creating {@link Renderer}s to be used by the instance.
 * @param trackSelector The {@link TrackSelector} that will be used by the instance.
 * @param loadControl The {@link LoadControl} that will be used by the instance.
 * @param drmSessionManager An optional {@link DrmSessionManager}. May be null if the instance
 *     will not be used for DRM protected playbacks.
 * @param bandwidthMeter The {@link BandwidthMeter} that will be used by the instance.
 * @param analyticsCollectorFactory A factory for creating the {@link AnalyticsCollector} that
 *     will collect and forward all player events.
 * @param looper The {@link Looper} which must be used for all calls to the player and which is
 *     used to call listeners on.
 */
protected SimpleExoPlayer(
    RenderersFactory renderersFactory,
    TrackSelector trackSelector,
    LoadControl loadControl,
    @Nullable DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
    BandwidthMeter bandwidthMeter,
    AnalyticsCollector.Factory analyticsCollectorFactory,
    Looper looper) {
  this(
      renderersFactory,
      trackSelector,
      loadControl,
      drmSessionManager,
      bandwidthMeter,
      analyticsCollectorFactory,
      Clock.DEFAULT,
      looper);
}
 
Example 2
Source File: SimpleExoPlayer.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param renderersFactory A factory for creating {@link Renderer}s to be used by the instance.
 * @param trackSelector The {@link TrackSelector} that will be used by the instance.
 * @param loadControl The {@link LoadControl} that will be used by the instance.
 * @param drmSessionManager An optional {@link DrmSessionManager}. May be null if the instance
 *     will not be used for DRM protected playbacks.
 * @param bandwidthMeter The {@link BandwidthMeter} that will be used by the instance.
 * @param analyticsCollectorFactory A factory for creating the {@link AnalyticsCollector} that
 *     will collect and forward all player events.
 * @param looper The {@link Looper} which must be used for all calls to the player and which is
 *     used to call listeners on.
 */
protected SimpleExoPlayer(
    RenderersFactory renderersFactory,
    TrackSelector trackSelector,
    LoadControl loadControl,
    @Nullable DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
    BandwidthMeter bandwidthMeter,
    AnalyticsCollector.Factory analyticsCollectorFactory,
    Looper looper) {
  this(
      renderersFactory,
      trackSelector,
      loadControl,
      drmSessionManager,
      bandwidthMeter,
      analyticsCollectorFactory,
      Clock.DEFAULT,
      looper);
}
 
Example 3
Source File: AdaptiveTrackSelection.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * @deprecated Use {@link #Factory(int, int, int, float)} instead. Custom bandwidth meter should
 *     be directly passed to the player in {@link SimpleExoPlayer.Builder}.
 */
@Deprecated
@SuppressWarnings("deprecation")
public Factory(
    BandwidthMeter bandwidthMeter,
    int minDurationForQualityIncreaseMs,
    int maxDurationForQualityDecreaseMs,
    int minDurationToRetainAfterDiscardMs,
    float bandwidthFraction) {
  this(
      bandwidthMeter,
      minDurationForQualityIncreaseMs,
      maxDurationForQualityDecreaseMs,
      minDurationToRetainAfterDiscardMs,
      bandwidthFraction,
      DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
      DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
      Clock.DEFAULT);
}
 
Example 4
Source File: AdaptiveTrackSelection.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * @param group The {@link TrackGroup}.
 * @param tracks The indices of the selected tracks within the {@link TrackGroup}. Must not be
 *     empty. May be in any order.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth.
 */
public AdaptiveTrackSelection(TrackGroup group, int[] tracks,
    BandwidthMeter bandwidthMeter) {
  this(
      group,
      tracks,
      bandwidthMeter,
      /* reservedBandwidth= */ 0,
      DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS,
      DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS,
      DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS,
      DEFAULT_BANDWIDTH_FRACTION,
      DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
      DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
      Clock.DEFAULT);
}
 
Example 5
Source File: CompositeTrackSelectorCreator.java    From no-player with Apache License 2.0 6 votes vote down vote up
CompositeTrackSelector create(Options options, DefaultBandwidthMeter bandwidthMeter) {
    TrackSelection.Factory adaptiveTrackSelectionFactory = new AdaptiveTrackSelection.Factory(
            bandwidthMeter,
            options.minDurationBeforeQualityIncreaseInMillis(),
            AdaptiveTrackSelection.DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS,
            AdaptiveTrackSelection.DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS,
            AdaptiveTrackSelection.DEFAULT_BANDWIDTH_FRACTION,
            AdaptiveTrackSelection.DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
            AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
            Clock.DEFAULT
    );
    DefaultTrackSelector trackSelector = new DefaultTrackSelector(adaptiveTrackSelectionFactory);
    DefaultTrackSelector.Parameters trackSelectorParameters = trackSelector.buildUponParameters()
            .setMaxVideoBitrate(options.maxVideoBitrate())
            .build();
    trackSelector.setParameters(trackSelectorParameters);

    ExoPlayerTrackSelector exoPlayerTrackSelector = ExoPlayerTrackSelector.newInstance(trackSelector);
    ExoPlayerAudioTrackSelector audioTrackSelector = new ExoPlayerAudioTrackSelector(exoPlayerTrackSelector);
    ExoPlayerVideoTrackSelector videoTrackSelector = new ExoPlayerVideoTrackSelector(exoPlayerTrackSelector);
    ExoPlayerSubtitleTrackSelector subtitleTrackSelector = new ExoPlayerSubtitleTrackSelector(exoPlayerTrackSelector);
    return new CompositeTrackSelector(trackSelector, audioTrackSelector, videoTrackSelector, subtitleTrackSelector);
}
 
Example 6
Source File: AdaptiveTrackSelection.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param group The {@link TrackGroup}.
 * @param tracks The indices of the selected tracks within the {@link TrackGroup}. Must not be
 *     empty. May be in any order.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth.
 */
public AdaptiveTrackSelection(TrackGroup group, int[] tracks,
    BandwidthMeter bandwidthMeter) {
  this(
      group,
      tracks,
      bandwidthMeter,
      DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS,
      DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS,
      DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS,
      DEFAULT_BANDWIDTH_FRACTION,
      DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
      DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
      Clock.DEFAULT);
}
 
Example 7
Source File: BufferSizeAdaptationBuilder.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/** Creates builder with default values. */
public BufferSizeAdaptationBuilder() {
  clock = Clock.DEFAULT;
  minBufferMs = DEFAULT_MIN_BUFFER_MS;
  maxBufferMs = DEFAULT_MAX_BUFFER_MS;
  bufferForPlaybackMs = DEFAULT_BUFFER_FOR_PLAYBACK_MS;
  bufferForPlaybackAfterRebufferMs = DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS;
  hysteresisBufferMs = DEFAULT_HYSTERESIS_BUFFER_MS;
  startUpBandwidthFraction = DEFAULT_START_UP_BANDWIDTH_FRACTION;
  startUpMinBufferForQualityIncreaseMs = DEFAULT_START_UP_MIN_BUFFER_FOR_QUALITY_INCREASE_MS;
  dynamicFormatFilter = DynamicFormatFilter.NO_FILTER;
}
 
Example 8
Source File: AdaptiveTrackSelection.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/** Creates an adaptive track selection factory with default parameters. */
public Factory() {
  this(
      DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS,
      DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS,
      DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS,
      DEFAULT_BANDWIDTH_FRACTION,
      DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
      DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
      Clock.DEFAULT);
}
 
Example 9
Source File: DefaultBandwidthMeter.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/** @deprecated Use {@link Builder} instead. */
@Deprecated
public DefaultBandwidthMeter() {
  this(
      /* context= */ null,
      /* initialBitrateEstimates= */ new SparseArray<>(),
      DEFAULT_SLIDING_WINDOW_MAX_WEIGHT,
      Clock.DEFAULT,
      /* resetOnNetworkTypeChange= */ false);
}
 
Example 10
Source File: ExoPlayerFactory.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an {@link ExoPlayer} instance.
 *
 * @param context A {@link Context}.
 * @param renderers The {@link Renderer}s that will be used by the instance.
 * @param trackSelector The {@link TrackSelector} that will be used by the instance.
 * @param loadControl The {@link LoadControl} that will be used by the instance.
 * @param bandwidthMeter The {@link BandwidthMeter} that will be used by the instance.
 * @param looper The {@link Looper} which must be used for all calls to the player and which is
 *     used to call listeners on.
 */
@SuppressWarnings("unused")
public static ExoPlayer newInstance(
    Context context,
    Renderer[] renderers,
    TrackSelector trackSelector,
    LoadControl loadControl,
    BandwidthMeter bandwidthMeter,
    Looper looper) {
  return new ExoPlayerImpl(
      renderers, trackSelector, loadControl, bandwidthMeter, Clock.DEFAULT, looper);
}
 
Example 11
Source File: AdaptiveTrackSelection.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/** Creates an adaptive track selection factory with default parameters. */
public Factory() {
  this(
      DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS,
      DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS,
      DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS,
      DEFAULT_BANDWIDTH_FRACTION,
      DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
      DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
      Clock.DEFAULT);
}
 
Example 12
Source File: AdaptiveTrackSelection.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param group The {@link TrackGroup}.
 * @param tracks The indices of the selected tracks within the {@link TrackGroup}. Must not be
 *     empty. May be in any order.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth.
 */
public AdaptiveTrackSelection(TrackGroup group, int[] tracks,
    BandwidthMeter bandwidthMeter) {
  this(
      group,
      tracks,
      bandwidthMeter,
      DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS,
      DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS,
      DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS,
      DEFAULT_BANDWIDTH_FRACTION,
      DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
      DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
      Clock.DEFAULT);
}
 
Example 13
Source File: AdaptiveTrackSelection.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param group The {@link TrackGroup}.
 * @param tracks The indices of the selected tracks within the {@link TrackGroup}. Must not be
 *     empty. May be in any order.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth.
 */
public AdaptiveTrackSelection(TrackGroup group, int[] tracks,
    BandwidthMeter bandwidthMeter) {
  this(
      group,
      tracks,
      bandwidthMeter,
      DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS,
      DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS,
      DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS,
      DEFAULT_BANDWIDTH_FRACTION,
      DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
      DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
      Clock.DEFAULT);
}
 
Example 14
Source File: AdaptiveTrackSelection.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @deprecated Use {@link #Factory()} instead. Custom bandwidth meter should be directly passed
 *     to the player in {@link ExoPlayerFactory}.
 */
@Deprecated
@SuppressWarnings("deprecation")
public Factory(BandwidthMeter bandwidthMeter) {
  this(
      bandwidthMeter,
      DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS,
      DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS,
      DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS,
      DEFAULT_BANDWIDTH_FRACTION,
      DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
      DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
      Clock.DEFAULT);
}
 
Example 15
Source File: DefaultBandwidthMeter.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a builder with default parameters and without listener.
 *
 * @param context A context.
 */
public Builder(Context context) {
  // Handling of null is for backward compatibility only.
  this.context = context == null ? null : context.getApplicationContext();
  initialBitrateEstimates = getInitialBitrateEstimatesForCountry(Util.getCountryCode(context));
  slidingWindowMaxWeight = DEFAULT_SLIDING_WINDOW_MAX_WEIGHT;
  clock = Clock.DEFAULT;
  resetOnNetworkTypeChange = true;
}
 
Example 16
Source File: ExoPlayerFactory.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an {@link ExoPlayer} instance.
 *
 * @param context A {@link Context}.
 * @param renderers The {@link Renderer}s that will be used by the instance.
 * @param trackSelector The {@link TrackSelector} that will be used by the instance.
 * @param loadControl The {@link LoadControl} that will be used by the instance.
 * @param bandwidthMeter The {@link BandwidthMeter} that will be used by the instance.
 * @param looper The {@link Looper} which must be used for all calls to the player and which is
 *     used to call listeners on.
 */
@SuppressWarnings("unused")
public static ExoPlayer newInstance(
    Context context,
    Renderer[] renderers,
    TrackSelector trackSelector,
    LoadControl loadControl,
    BandwidthMeter bandwidthMeter,
    Looper looper) {
  return new ExoPlayerImpl(
      renderers, trackSelector, loadControl, bandwidthMeter, Clock.DEFAULT, looper);
}
 
Example 17
Source File: DefaultBandwidthMeter.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Creates a bandwidth meter with default parameters. */
public DefaultBandwidthMeter() {
  this(DEFAULT_INITIAL_BITRATE_ESTIMATE, DEFAULT_SLIDING_WINDOW_MAX_WEIGHT, Clock.DEFAULT);
}
 
Example 18
Source File: DefaultBandwidthMeter.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Creates a builder with default parameters and without listener. */
public Builder() {
  initialBitrateEstimate = DEFAULT_INITIAL_BITRATE_ESTIMATE;
  slidingWindowMaxWeight = DEFAULT_SLIDING_WINDOW_MAX_WEIGHT;
  clock = Clock.DEFAULT;
}
 
Example 19
Source File: AdaptiveTrackSelection.java    From TelePlus-Android with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates an adaptive track selection factory.
 *
 * @param minDurationForQualityIncreaseMs The minimum duration of buffered data required for the
 *     selected track to switch to one of higher quality.
 * @param maxDurationForQualityDecreaseMs The maximum duration of buffered data required for the
 *     selected track to switch to one of lower quality.
 * @param minDurationToRetainAfterDiscardMs When switching to a track of significantly higher
 *     quality, the selection may indicate that media already buffered at the lower quality can
 *     be discarded to speed up the switch. This is the minimum duration of media that must be
 *     retained at the lower quality.
 * @param bandwidthFraction The fraction of the available bandwidth that the selection should
 *     consider available for use. Setting to a value less than 1 is recommended to account for
 *     inaccuracies in the bandwidth estimator.
 */
public Factory(
    int minDurationForQualityIncreaseMs,
    int maxDurationForQualityDecreaseMs,
    int minDurationToRetainAfterDiscardMs,
    float bandwidthFraction) {
  this(
      minDurationForQualityIncreaseMs,
      maxDurationForQualityDecreaseMs,
      minDurationToRetainAfterDiscardMs,
      bandwidthFraction,
      DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
      DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
      Clock.DEFAULT);
}
 
Example 20
Source File: AdaptiveTrackSelection.java    From Telegram-FOSS with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates an adaptive track selection factory.
 *
 * @param minDurationForQualityIncreaseMs The minimum duration of buffered data required for the
 *     selected track to switch to one of higher quality.
 * @param maxDurationForQualityDecreaseMs The maximum duration of buffered data required for the
 *     selected track to switch to one of lower quality.
 * @param minDurationToRetainAfterDiscardMs When switching to a track of significantly higher
 *     quality, the selection may indicate that media already buffered at the lower quality can
 *     be discarded to speed up the switch. This is the minimum duration of media that must be
 *     retained at the lower quality.
 * @param bandwidthFraction The fraction of the available bandwidth that the selection should
 *     consider available for use. Setting to a value less than 1 is recommended to account for
 *     inaccuracies in the bandwidth estimator.
 */
public Factory(
    int minDurationForQualityIncreaseMs,
    int maxDurationForQualityDecreaseMs,
    int minDurationToRetainAfterDiscardMs,
    float bandwidthFraction) {
  this(
      minDurationForQualityIncreaseMs,
      maxDurationForQualityDecreaseMs,
      minDurationToRetainAfterDiscardMs,
      bandwidthFraction,
      DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
      DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
      Clock.DEFAULT);
}