diff --git a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java index bd6824e559..683da2d0c4 100644 --- a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java +++ b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java @@ -125,7 +125,7 @@ public final class DashMediaSource extends BaseMediaSource { * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used * to load (and refresh) the manifest. May be {@code null} if the factory will only ever be * used to create create media sources with sideloaded manifests via {@link - * #createMediaSource(DashManifest, Handler, MediaSourceEventListener)}. + * #createMediaSource(DashManifest, MediaItem)}. */ public Factory( DashChunkSource.Factory chunkSourceFactory, @@ -327,39 +327,6 @@ public final class DashMediaSource extends BaseMediaSource { livePresentationDelayOverridesManifest); } - /** - * @deprecated Use {@link #createMediaSource(DashManifest)} and {@link - * #addEventListener(Handler, MediaSourceEventListener)} instead. - */ - @Deprecated - public DashMediaSource createMediaSource( - DashManifest manifest, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - DashMediaSource mediaSource = createMediaSource(manifest); - if (eventHandler != null && eventListener != null) { - mediaSource.addEventListener(eventHandler, eventListener); - } - return mediaSource; - } - - /** - * @deprecated Use {@link #createMediaSource(MediaItem)} and {@link #addEventListener(Handler, - * MediaSourceEventListener)} instead. - */ - @SuppressWarnings("deprecation") - @Deprecated - public DashMediaSource createMediaSource( - Uri manifestUri, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - DashMediaSource mediaSource = createMediaSource(manifestUri); - if (eventHandler != null && eventListener != null) { - mediaSource.addEventListener(eventHandler, eventListener); - } - return mediaSource; - } - /** @deprecated Use {@link #createMediaSource(MediaItem)} instead. */ @SuppressWarnings("deprecation") @Deprecated @@ -493,121 +460,6 @@ public final class DashMediaSource extends BaseMediaSource { private int firstPeriodId; - /** @deprecated Use {@link Factory} instead. */ - @Deprecated - @SuppressWarnings("deprecation") - public DashMediaSource( - DashManifest manifest, - DashChunkSource.Factory chunkSourceFactory, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - this( - manifest, - chunkSourceFactory, - DefaultLoadErrorHandlingPolicy.DEFAULT_MIN_LOADABLE_RETRY_COUNT, - eventHandler, - eventListener); - } - - /** @deprecated Use {@link Factory} instead. */ - @Deprecated - public DashMediaSource( - DashManifest manifest, - DashChunkSource.Factory chunkSourceFactory, - int minLoadableRetryCount, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - this( - new MediaItem.Builder() - .setMediaId(DUMMY_MEDIA_ID) - .setMimeType(MimeTypes.APPLICATION_MPD) - .setUri(Uri.EMPTY) - .build(), - manifest, - /* manifestDataSourceFactory= */ null, - /* manifestParser= */ null, - chunkSourceFactory, - new DefaultCompositeSequenceableLoaderFactory(), - DrmSessionManager.getDummyDrmSessionManager(), - new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount), - DEFAULT_LIVE_PRESENTATION_DELAY_MS, - /* livePresentationDelayOverridesManifest= */ false); - if (eventHandler != null && eventListener != null) { - addEventListener(eventHandler, eventListener); - } - } - - /** @deprecated Use {@link Factory} instead. */ - @Deprecated - @SuppressWarnings("deprecation") - public DashMediaSource( - Uri manifestUri, - DataSource.Factory manifestDataSourceFactory, - DashChunkSource.Factory chunkSourceFactory, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - this( - manifestUri, - manifestDataSourceFactory, - chunkSourceFactory, - DefaultLoadErrorHandlingPolicy.DEFAULT_MIN_LOADABLE_RETRY_COUNT, - DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS, - eventHandler, - eventListener); - } - - /** @deprecated Use {@link Factory} instead. */ - @Deprecated - @SuppressWarnings("deprecation") - public DashMediaSource( - Uri manifestUri, - DataSource.Factory manifestDataSourceFactory, - DashChunkSource.Factory chunkSourceFactory, - int minLoadableRetryCount, - long livePresentationDelayMs, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - this( - manifestUri, - manifestDataSourceFactory, - new DashManifestParser(), - chunkSourceFactory, - minLoadableRetryCount, - livePresentationDelayMs, - eventHandler, - eventListener); - } - - /** @deprecated Use {@link Factory} instead. */ - @Deprecated - @SuppressWarnings("deprecation") - public DashMediaSource( - Uri manifestUri, - DataSource.Factory manifestDataSourceFactory, - ParsingLoadable.Parser manifestParser, - DashChunkSource.Factory chunkSourceFactory, - int minLoadableRetryCount, - long livePresentationDelayMs, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - this( - new MediaItem.Builder().setUri(manifestUri).setMimeType(MimeTypes.APPLICATION_MPD).build(), - /* manifest= */ null, - manifestDataSourceFactory, - manifestParser, - chunkSourceFactory, - new DefaultCompositeSequenceableLoaderFactory(), - DrmSessionManager.getDummyDrmSessionManager(), - new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount), - livePresentationDelayMs == DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS - ? DEFAULT_LIVE_PRESENTATION_DELAY_MS - : livePresentationDelayMs, - livePresentationDelayMs != DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS); - if (eventHandler != null && eventListener != null) { - addEventListener(eventHandler, eventListener); - } - } - private DashMediaSource( MediaItem mediaItem, @Nullable DashManifest manifest, diff --git a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java index b58f3da928..3a7a8de791 100644 --- a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java +++ b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java @@ -20,7 +20,6 @@ import static java.lang.Math.max; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.net.Uri; -import android.os.Handler; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import com.google.android.exoplayer2.C; @@ -318,23 +317,6 @@ public final class HlsMediaSource extends BaseMediaSource return this; } - /** - * @deprecated Use {@link #createMediaSource(MediaItem)} and {@link #addEventListener(Handler, - * MediaSourceEventListener)} instead. - */ - @SuppressWarnings("deprecation") - @Deprecated - public HlsMediaSource createMediaSource( - Uri playlistUri, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - HlsMediaSource mediaSource = createMediaSource(playlistUri); - if (eventHandler != null && eventListener != null) { - mediaSource.addEventListener(eventHandler, eventListener); - } - return mediaSource; - } - /** @deprecated Use {@link #createMediaSource(MediaItem)} instead. */ @SuppressWarnings("deprecation") @Deprecated diff --git a/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java b/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java index a2ebb06936..d24394edbc 100644 --- a/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java +++ b/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java @@ -106,7 +106,7 @@ public final class SsMediaSource extends BaseMediaSource * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used * to load (and refresh) the manifest. May be {@code null} if the factory will only ever be * used to create create media sources with sideloaded manifests via {@link - * #createMediaSource(SsManifest, Handler, MediaSourceEventListener)}. + * #createMediaSource(SsManifest, MediaItem)}. */ public Factory( SsChunkSource.Factory chunkSourceFactory, @@ -290,39 +290,6 @@ public final class SsMediaSource extends BaseMediaSource livePresentationDelayMs); } - /** - * @deprecated Use {@link #createMediaSource(SsManifest)} and {@link #addEventListener(Handler, - * MediaSourceEventListener)} instead. - */ - @Deprecated - public SsMediaSource createMediaSource( - SsManifest manifest, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - SsMediaSource mediaSource = createMediaSource(manifest); - if (eventHandler != null && eventListener != null) { - mediaSource.addEventListener(eventHandler, eventListener); - } - return mediaSource; - } - - /** - * @deprecated Use {@link #createMediaSource(MediaItem)} and {@link #addEventListener(Handler, - * MediaSourceEventListener)} instead. - */ - @SuppressWarnings("deprecation") - @Deprecated - public SsMediaSource createMediaSource( - Uri manifestUri, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - SsMediaSource mediaSource = createMediaSource(manifestUri); - if (eventHandler != null && eventListener != null) { - mediaSource.addEventListener(eventHandler, eventListener); - } - return mediaSource; - } - /** * Returns a new {@link SsMediaSource} using the current parameters. * @@ -412,162 +379,6 @@ public final class SsMediaSource extends BaseMediaSource private Handler manifestRefreshHandler; - /** - * Constructs an instance to play a given {@link SsManifest}, which must not be live. - * - * @param manifest The manifest. {@link SsManifest#isLive} must be false. - * @param chunkSourceFactory A factory for {@link SsChunkSource} instances. - * @param eventHandler A handler for events. May be null if delivery of events is not required. - * @param eventListener A listener of events. May be null if delivery of events is not required. - * @deprecated Use {@link Factory} instead. - */ - @Deprecated - @SuppressWarnings("deprecation") - public SsMediaSource( - SsManifest manifest, - SsChunkSource.Factory chunkSourceFactory, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - this( - manifest, - chunkSourceFactory, - DefaultLoadErrorHandlingPolicy.DEFAULT_MIN_LOADABLE_RETRY_COUNT, - eventHandler, - eventListener); - } - - /** - * Constructs an instance to play a given {@link SsManifest}, which must not be live. - * - * @param manifest The manifest. {@link SsManifest#isLive} must be false. - * @param chunkSourceFactory A factory for {@link SsChunkSource} instances. - * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs. - * @param eventHandler A handler for events. May be null if delivery of events is not required. - * @param eventListener A listener of events. May be null if delivery of events is not required. - * @deprecated Use {@link Factory} instead. - */ - @Deprecated - public SsMediaSource( - SsManifest manifest, - SsChunkSource.Factory chunkSourceFactory, - int minLoadableRetryCount, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - this( - new MediaItem.Builder().setUri(Uri.EMPTY).setMimeType(MimeTypes.APPLICATION_SS).build(), - manifest, - /* manifestDataSourceFactory= */ null, - /* manifestParser= */ null, - chunkSourceFactory, - new DefaultCompositeSequenceableLoaderFactory(), - DrmSessionManager.getDummyDrmSessionManager(), - new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount), - DEFAULT_LIVE_PRESENTATION_DELAY_MS); - if (eventHandler != null && eventListener != null) { - addEventListener(eventHandler, eventListener); - } - } - - /** - * Constructs an instance to play the manifest at a given {@link Uri}, which may be live or - * on-demand. - * - * @param manifestUri The manifest {@link Uri}. - * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used - * to load (and refresh) the manifest. - * @param chunkSourceFactory A factory for {@link SsChunkSource} instances. - * @param eventHandler A handler for events. May be null if delivery of events is not required. - * @param eventListener A listener of events. May be null if delivery of events is not required. - * @deprecated Use {@link Factory} instead. - */ - @Deprecated - @SuppressWarnings("deprecation") - public SsMediaSource( - Uri manifestUri, - DataSource.Factory manifestDataSourceFactory, - SsChunkSource.Factory chunkSourceFactory, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - this( - manifestUri, - manifestDataSourceFactory, - chunkSourceFactory, - DefaultLoadErrorHandlingPolicy.DEFAULT_MIN_LOADABLE_RETRY_COUNT, - DEFAULT_LIVE_PRESENTATION_DELAY_MS, - eventHandler, - eventListener); - } - - /** - * Constructs an instance to play the manifest at a given {@link Uri}, which may be live or - * on-demand. - * - * @param manifestUri The manifest {@link Uri}. - * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used - * to load (and refresh) the manifest. - * @param chunkSourceFactory A factory for {@link SsChunkSource} instances. - * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs. - * @param livePresentationDelayMs For live playbacks, the duration in milliseconds by which the - * default start position should precede the end of the live window. - * @param eventHandler A handler for events. May be null if delivery of events is not required. - * @param eventListener A listener of events. May be null if delivery of events is not required. - * @deprecated Use {@link Factory} instead. - */ - @Deprecated - @SuppressWarnings("deprecation") - public SsMediaSource( - Uri manifestUri, - DataSource.Factory manifestDataSourceFactory, - SsChunkSource.Factory chunkSourceFactory, - int minLoadableRetryCount, - long livePresentationDelayMs, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - this(manifestUri, manifestDataSourceFactory, new SsManifestParser(), chunkSourceFactory, - minLoadableRetryCount, livePresentationDelayMs, eventHandler, eventListener); - } - - /** - * Constructs an instance to play the manifest at a given {@link Uri}, which may be live or - * on-demand. - * - * @param manifestUri The manifest {@link Uri}. - * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used - * to load (and refresh) the manifest. - * @param manifestParser A parser for loaded manifest data. - * @param chunkSourceFactory A factory for {@link SsChunkSource} instances. - * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs. - * @param livePresentationDelayMs For live playbacks, the duration in milliseconds by which the - * default start position should precede the end of the live window. - * @param eventHandler A handler for events. May be null if delivery of events is not required. - * @param eventListener A listener of events. May be null if delivery of events is not required. - * @deprecated Use {@link Factory} instead. - */ - @Deprecated - public SsMediaSource( - Uri manifestUri, - DataSource.Factory manifestDataSourceFactory, - ParsingLoadable.Parser manifestParser, - SsChunkSource.Factory chunkSourceFactory, - int minLoadableRetryCount, - long livePresentationDelayMs, - @Nullable Handler eventHandler, - @Nullable MediaSourceEventListener eventListener) { - this( - new MediaItem.Builder().setUri(manifestUri).setMimeType(MimeTypes.APPLICATION_SS).build(), - /* manifest= */ null, - manifestDataSourceFactory, - manifestParser, - chunkSourceFactory, - new DefaultCompositeSequenceableLoaderFactory(), - DrmSessionManager.getDummyDrmSessionManager(), - new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount), - livePresentationDelayMs); - if (eventHandler != null && eventListener != null) { - addEventListener(eventHandler, eventListener); - } - } - private SsMediaSource( MediaItem mediaItem, @Nullable SsManifest manifest,