Search in sources :

Example 1 with ForwardingTimeline

use of androidx.media3.exoplayer.source.ForwardingTimeline in project media by androidx.

the class ProgressiveMediaSource method notifySourceInfoRefreshed.

// Internal methods.
private void notifySourceInfoRefreshed() {
    // TODO: Split up isDynamic into multiple fields to indicate which values may change. Then
    // indicate that the duration may change until it's known. See [internal: b/69703223].
    Timeline timeline = new SinglePeriodTimeline(timelineDurationUs, timelineIsSeekable, /* isDynamic= */
    false, /* useLiveConfiguration= */
    timelineIsLive, /* manifest= */
    null, mediaItem);
    if (timelineIsPlaceholder) {
        // TODO: Actually prepare the extractors during preparation so that we don't need a
        // placeholder. See https://github.com/google/ExoPlayer/issues/4727.
        timeline = new ForwardingTimeline(timeline) {

            @Override
            public Window getWindow(int windowIndex, Window window, long defaultPositionProjectionUs) {
                super.getWindow(windowIndex, window, defaultPositionProjectionUs);
                window.isPlaceholder = true;
                return window;
            }

            @Override
            public Period getPeriod(int periodIndex, Period period, boolean setIds) {
                super.getPeriod(periodIndex, period, setIds);
                period.isPlaceholder = true;
                return period;
            }
        };
    }
    refreshSourceInfo(timeline);
}
Also used : Timeline(androidx.media3.common.Timeline)

Example 2 with ForwardingTimeline

use of androidx.media3.exoplayer.source.ForwardingTimeline in project media by androidx.

the class RtspMediaSource method notifySourceInfoRefreshed.

// Internal methods.
private void notifySourceInfoRefreshed() {
    Timeline timeline = new SinglePeriodTimeline(timelineDurationUs, timelineIsSeekable, /* isDynamic= */
    false, /* useLiveConfiguration= */
    timelineIsLive, /* manifest= */
    null, mediaItem);
    if (timelineIsPlaceholder) {
        timeline = new ForwardingTimeline(timeline) {

            @Override
            public Window getWindow(int windowIndex, Window window, long defaultPositionProjectionUs) {
                super.getWindow(windowIndex, window, defaultPositionProjectionUs);
                window.isPlaceholder = true;
                return window;
            }

            @Override
            public Period getPeriod(int periodIndex, Period period, boolean setIds) {
                super.getPeriod(periodIndex, period, setIds);
                period.isPlaceholder = true;
                return period;
            }
        };
    }
    refreshSourceInfo(timeline);
}
Also used : SinglePeriodTimeline(androidx.media3.exoplayer.source.SinglePeriodTimeline) ForwardingTimeline(androidx.media3.exoplayer.source.ForwardingTimeline) Timeline(androidx.media3.common.Timeline) ForwardingTimeline(androidx.media3.exoplayer.source.ForwardingTimeline) SinglePeriodTimeline(androidx.media3.exoplayer.source.SinglePeriodTimeline) MediaPeriod(androidx.media3.exoplayer.source.MediaPeriod)

Aggregations

Timeline (androidx.media3.common.Timeline)2 ForwardingTimeline (androidx.media3.exoplayer.source.ForwardingTimeline)1 MediaPeriod (androidx.media3.exoplayer.source.MediaPeriod)1 SinglePeriodTimeline (androidx.media3.exoplayer.source.SinglePeriodTimeline)1