Class ClippingMediaSource

  • All Implemented Interfaces:
    MediaSource

    @Deprecated
    public final class ClippingMediaSource
    extends WrappingMediaSource
    Deprecated.
    com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
    MediaSource that wraps a source and clips its timeline based on specified start/end positions. The wrapped source must consist of a single period.
    • Constructor Detail

      • ClippingMediaSource

        public ClippingMediaSource​(MediaSource mediaSource,
                                   long startPositionUs,
                                   long endPositionUs)
        Deprecated.
        Creates a new clipping source that wraps the specified source and provides samples between the specified start and end position.
        Parameters:
        mediaSource - The single-period source to wrap.
        startPositionUs - The start position within mediaSource's window at which to start providing samples, in microseconds.
        endPositionUs - The end position within mediaSource's window at which to stop providing samples, in microseconds. Specify C.TIME_END_OF_SOURCE to provide samples from the specified start point up to the end of the source. Specifying a position that exceeds the mediaSource's duration will also result in the end of the source not being clipped.
      • ClippingMediaSource

        public ClippingMediaSource​(MediaSource mediaSource,
                                   long durationUs)
        Deprecated.
        Creates a new clipping source that wraps the specified source and provides samples from the default position for the specified duration.
        Parameters:
        mediaSource - The single-period source to wrap.
        durationUs - The duration from the default position in the window in mediaSource's timeline at which to stop providing samples. Specifying a duration that exceeds the mediaSource's duration will result in the end of the source not being clipped.
      • ClippingMediaSource

        public ClippingMediaSource​(MediaSource mediaSource,
                                   long startPositionUs,
                                   long endPositionUs,
                                   boolean enableInitialDiscontinuity,
                                   boolean allowDynamicClippingUpdates,
                                   boolean relativeToDefaultPosition)
        Deprecated.
        Creates a new clipping source that wraps the specified source.

        If the start point is guaranteed to be a key frame, pass false to enableInitialPositionDiscontinuity to suppress an initial discontinuity when a period is first read from.

        For live streams, if the clipping positions should move with the live window, pass true to allowDynamicClippingUpdates. Otherwise, the live stream ends when the playback reaches endPositionUs in the last reported live window at the time a media period was created.

        Parameters:
        mediaSource - The single-period source to wrap.
        startPositionUs - The start position at which to start providing samples, in microseconds. If relativeToDefaultPosition is false, this position is relative to the start of the window in mediaSource's timeline. If relativeToDefaultPosition is true, this position is relative to the default position in the window in mediaSource's timeline.
        endPositionUs - The end position at which to stop providing samples, in microseconds. Specify C.TIME_END_OF_SOURCE to provide samples from the specified start point up to the end of the source. Specifying a position that exceeds the mediaSource's duration will also result in the end of the source not being clipped. If relativeToDefaultPosition is false, the specified position is relative to the start of the window in mediaSource's timeline. If relativeToDefaultPosition is true, this position is relative to the default position in the window in mediaSource's timeline.
        enableInitialDiscontinuity - Whether the initial discontinuity should be enabled.
        allowDynamicClippingUpdates - Whether the clipping of active media periods moves with a live window. If false, playback ends when it reaches endPositionUs in the last reported live window at the time a media period was created.
        relativeToDefaultPosition - Whether startPositionUs and endPositionUs are relative to the default position in the window in mediaSource's timeline.