mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Clean up use of deprecated APIs
- Add @Deprecated on overrides of deprecated method. - Suppress deprecation warnings where appropriate. - Use non-deprecated alternatives where appropriate. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=210092434
This commit is contained in:
parent
0da7f6ca08
commit
924a76d532
29 changed files with 106 additions and 23 deletions
|
|
@ -76,9 +76,7 @@ import com.google.android.exoplayer2.util.Util;
|
||||||
contentMediaSource,
|
contentMediaSource,
|
||||||
/* adMediaSourceFactory= */ this,
|
/* adMediaSourceFactory= */ this,
|
||||||
adsLoader,
|
adsLoader,
|
||||||
playerView.getOverlayFrameLayout(),
|
playerView.getOverlayFrameLayout());
|
||||||
/* eventHandler= */ null,
|
|
||||||
/* eventListener= */ null);
|
|
||||||
|
|
||||||
// Prepare the player with the source.
|
// Prepare the player with the source.
|
||||||
player.seekTo(contentPosition);
|
player.seekTo(contentPosition);
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,8 @@ public class SampleChooserActivity extends Activity
|
||||||
List<SampleGroup> result = new ArrayList<>();
|
List<SampleGroup> result = new ArrayList<>();
|
||||||
Context context = getApplicationContext();
|
Context context = getApplicationContext();
|
||||||
String userAgent = Util.getUserAgent(context, "ExoPlayerDemo");
|
String userAgent = Util.getUserAgent(context, "ExoPlayerDemo");
|
||||||
DataSource dataSource = new DefaultDataSource(context, null, userAgent, false);
|
DataSource dataSource =
|
||||||
|
new DefaultDataSource(context, userAgent, /* allowCrossProtocolRedirects= */ false);
|
||||||
for (String uri : uris) {
|
for (String uri : uris) {
|
||||||
DataSpec dataSpec = new DataSpec(Uri.parse(uri));
|
DataSpec dataSpec = new DataSpec(Uri.parse(uri));
|
||||||
InputStream inputStream = new DataSourceInputStream(dataSource, dataSpec);
|
InputStream inputStream = new DataSourceInputStream(dataSource, dataSpec);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,11 @@ public final class RtmpDataSourceFactory implements DataSource.Factory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataSource createDataSource() {
|
public DataSource createDataSource() {
|
||||||
return new RtmpDataSource(listener);
|
RtmpDataSource dataSource = new RtmpDataSource();
|
||||||
|
if (listener != null) {
|
||||||
|
dataSource.addTransferListener(listener);
|
||||||
|
}
|
||||||
|
return dataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,7 @@ public class DefaultLoadControl implements LoadControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates a {@link DefaultLoadControl}. */
|
/** Creates a {@link DefaultLoadControl}. */
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public DefaultLoadControl createDefaultLoadControl() {
|
public DefaultLoadControl createDefaultLoadControl() {
|
||||||
if (allocator == null) {
|
if (allocator == null) {
|
||||||
allocator = new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE);
|
allocator = new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE);
|
||||||
|
|
@ -183,15 +184,15 @@ public class DefaultLoadControl implements LoadControl {
|
||||||
private int targetBufferSize;
|
private int targetBufferSize;
|
||||||
private boolean isBuffering;
|
private boolean isBuffering;
|
||||||
|
|
||||||
/**
|
/** Constructs a new instance, using the {@code DEFAULT_*} constants defined in this class. */
|
||||||
* Constructs a new instance, using the {@code DEFAULT_*} constants defined in this class.
|
@SuppressWarnings("deprecation")
|
||||||
*/
|
|
||||||
public DefaultLoadControl() {
|
public DefaultLoadControl() {
|
||||||
this(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE));
|
this(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Use {@link Builder} instead. */
|
/** @deprecated Use {@link Builder} instead. */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public DefaultLoadControl(DefaultAllocator allocator) {
|
public DefaultLoadControl(DefaultAllocator allocator) {
|
||||||
this(
|
this(
|
||||||
allocator,
|
allocator,
|
||||||
|
|
@ -205,6 +206,7 @@ public class DefaultLoadControl implements LoadControl {
|
||||||
|
|
||||||
/** @deprecated Use {@link Builder} instead. */
|
/** @deprecated Use {@link Builder} instead. */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public DefaultLoadControl(
|
public DefaultLoadControl(
|
||||||
DefaultAllocator allocator,
|
DefaultAllocator allocator,
|
||||||
int minBufferMs,
|
int minBufferMs,
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
|
||||||
protected static final int MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY = 50;
|
protected static final int MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY = 50;
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
@Nullable private final DrmSessionManager<FrameworkMediaCrypto> drmSessionManager;
|
private final @Nullable DrmSessionManager<FrameworkMediaCrypto> drmSessionManager;
|
||||||
private final @ExtensionRendererMode int extensionRendererMode;
|
private final @ExtensionRendererMode int extensionRendererMode;
|
||||||
private final long allowedVideoJoiningTimeMs;
|
private final long allowedVideoJoiningTimeMs;
|
||||||
|
|
||||||
|
|
@ -98,6 +98,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
|
||||||
* directly to {@link SimpleExoPlayer} or {@link ExoPlayerFactory}.
|
* directly to {@link SimpleExoPlayer} or {@link ExoPlayerFactory}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public DefaultRenderersFactory(
|
public DefaultRenderersFactory(
|
||||||
Context context, @Nullable DrmSessionManager<FrameworkMediaCrypto> drmSessionManager) {
|
Context context, @Nullable DrmSessionManager<FrameworkMediaCrypto> drmSessionManager) {
|
||||||
this(context, drmSessionManager, EXTENSION_RENDERER_MODE_OFF);
|
this(context, drmSessionManager, EXTENSION_RENDERER_MODE_OFF);
|
||||||
|
|
@ -111,7 +112,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
|
||||||
*/
|
*/
|
||||||
public DefaultRenderersFactory(
|
public DefaultRenderersFactory(
|
||||||
Context context, @ExtensionRendererMode int extensionRendererMode) {
|
Context context, @ExtensionRendererMode int extensionRendererMode) {
|
||||||
this(context, null, extensionRendererMode, DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS);
|
this(context, extensionRendererMode, DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -119,6 +120,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
|
||||||
* DrmSessionManager} directly to {@link SimpleExoPlayer} or {@link ExoPlayerFactory}.
|
* DrmSessionManager} directly to {@link SimpleExoPlayer} or {@link ExoPlayerFactory}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public DefaultRenderersFactory(
|
public DefaultRenderersFactory(
|
||||||
Context context,
|
Context context,
|
||||||
@Nullable DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
|
@Nullable DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
|
||||||
|
|
@ -138,7 +140,10 @@ public class DefaultRenderersFactory implements RenderersFactory {
|
||||||
Context context,
|
Context context,
|
||||||
@ExtensionRendererMode int extensionRendererMode,
|
@ExtensionRendererMode int extensionRendererMode,
|
||||||
long allowedVideoJoiningTimeMs) {
|
long allowedVideoJoiningTimeMs) {
|
||||||
this(context, null, extensionRendererMode, allowedVideoJoiningTimeMs);
|
this.context = context;
|
||||||
|
this.extensionRendererMode = extensionRendererMode;
|
||||||
|
this.allowedVideoJoiningTimeMs = allowedVideoJoiningTimeMs;
|
||||||
|
this.drmSessionManager = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -227,6 +227,7 @@ public interface ExoPlayer extends Player {
|
||||||
|
|
||||||
/** @deprecated Use {@link #createMessage(PlayerMessage.Target)} instead. */
|
/** @deprecated Use {@link #createMessage(PlayerMessage.Target)} instead. */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
void sendMessages(ExoPlayerMessage... messages);
|
void sendMessages(ExoPlayerMessage... messages);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -234,6 +235,7 @@ public interface ExoPlayer extends Player {
|
||||||
* PlayerMessage#blockUntilDelivered()}.
|
* PlayerMessage#blockUntilDelivered()}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
void blockingSendMessages(ExoPlayerMessage... messages);
|
void blockingSendMessages(ExoPlayerMessage... messages);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -415,6 +415,8 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void sendMessages(ExoPlayerMessage... messages) {
|
public void sendMessages(ExoPlayerMessage... messages) {
|
||||||
for (ExoPlayerMessage message : messages) {
|
for (ExoPlayerMessage message : messages) {
|
||||||
createMessage(message.target).setType(message.messageType).setPayload(message.message).send();
|
createMessage(message.target).setType(message.messageType).setPayload(message.message).send();
|
||||||
|
|
@ -432,6 +434,8 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void blockingSendMessages(ExoPlayerMessage... messages) {
|
public void blockingSendMessages(ExoPlayerMessage... messages) {
|
||||||
List<PlayerMessage> playerMessages = new ArrayList<>();
|
List<PlayerMessage> playerMessages = new ArrayList<>();
|
||||||
for (ExoPlayerMessage message : messages) {
|
for (ExoPlayerMessage message : messages) {
|
||||||
|
|
|
||||||
|
|
@ -392,6 +392,7 @@ public interface Player {
|
||||||
abstract class DefaultEventListener implements EventListener {
|
abstract class DefaultEventListener implements EventListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void onTimelineChanged(
|
public void onTimelineChanged(
|
||||||
Timeline timeline, @Nullable Object manifest, @TimelineChangeReason int reason) {
|
Timeline timeline, @Nullable Object manifest, @TimelineChangeReason int reason) {
|
||||||
// Call deprecated version. Otherwise, do nothing.
|
// Call deprecated version. Otherwise, do nothing.
|
||||||
|
|
|
||||||
|
|
@ -604,6 +604,7 @@ public class SimpleExoPlayer
|
||||||
* @deprecated Use {@link #addVideoListener(com.google.android.exoplayer2.video.VideoListener)}.
|
* @deprecated Use {@link #addVideoListener(com.google.android.exoplayer2.video.VideoListener)}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void setVideoListener(VideoListener listener) {
|
public void setVideoListener(VideoListener listener) {
|
||||||
videoListeners.clear();
|
videoListeners.clear();
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
|
|
@ -619,6 +620,7 @@ public class SimpleExoPlayer
|
||||||
* #removeVideoListener(com.google.android.exoplayer2.video.VideoListener)}.
|
* #removeVideoListener(com.google.android.exoplayer2.video.VideoListener)}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void clearVideoListener(VideoListener listener) {
|
public void clearVideoListener(VideoListener listener) {
|
||||||
removeVideoListener(listener);
|
removeVideoListener(listener);
|
||||||
}
|
}
|
||||||
|
|
@ -709,6 +711,7 @@ public class SimpleExoPlayer
|
||||||
* information.
|
* information.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void setVideoDebugListener(VideoRendererEventListener listener) {
|
public void setVideoDebugListener(VideoRendererEventListener listener) {
|
||||||
videoDebugListeners.retainAll(Collections.singleton(analyticsCollector));
|
videoDebugListeners.retainAll(Collections.singleton(analyticsCollector));
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
|
|
@ -739,6 +742,7 @@ public class SimpleExoPlayer
|
||||||
* information.
|
* information.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void setAudioDebugListener(AudioRendererEventListener listener) {
|
public void setAudioDebugListener(AudioRendererEventListener listener) {
|
||||||
audioDebugListeners.retainAll(Collections.singleton(analyticsCollector));
|
audioDebugListeners.retainAll(Collections.singleton(analyticsCollector));
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
|
|
@ -939,6 +943,8 @@ public class SimpleExoPlayer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void sendMessages(ExoPlayerMessage... messages) {
|
public void sendMessages(ExoPlayerMessage... messages) {
|
||||||
player.sendMessages(messages);
|
player.sendMessages(messages);
|
||||||
}
|
}
|
||||||
|
|
@ -949,6 +955,8 @@ public class SimpleExoPlayer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void blockingSendMessages(ExoPlayerMessage... messages) {
|
public void blockingSendMessages(ExoPlayerMessage... messages) {
|
||||||
player.blockingSendMessages(messages);
|
player.blockingSendMessages(messages);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -262,6 +262,7 @@ public final class ExtractorMediaSource extends BaseMediaSource
|
||||||
* @deprecated Use {@link Factory} instead.
|
* @deprecated Use {@link Factory} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public ExtractorMediaSource(
|
public ExtractorMediaSource(
|
||||||
Uri uri,
|
Uri uri,
|
||||||
DataSource.Factory dataSourceFactory,
|
DataSource.Factory dataSourceFactory,
|
||||||
|
|
@ -284,6 +285,7 @@ public final class ExtractorMediaSource extends BaseMediaSource
|
||||||
* @deprecated Use {@link Factory} instead.
|
* @deprecated Use {@link Factory} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public ExtractorMediaSource(
|
public ExtractorMediaSource(
|
||||||
Uri uri,
|
Uri uri,
|
||||||
DataSource.Factory dataSourceFactory,
|
DataSource.Factory dataSourceFactory,
|
||||||
|
|
@ -316,6 +318,7 @@ public final class ExtractorMediaSource extends BaseMediaSource
|
||||||
* @deprecated Use {@link Factory} instead.
|
* @deprecated Use {@link Factory} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public ExtractorMediaSource(
|
public ExtractorMediaSource(
|
||||||
Uri uri,
|
Uri uri,
|
||||||
DataSource.Factory dataSourceFactory,
|
DataSource.Factory dataSourceFactory,
|
||||||
|
|
@ -426,6 +429,8 @@ public final class ExtractorMediaSource extends BaseMediaSource
|
||||||
* Wraps a deprecated {@link EventListener}, invoking its callback from the equivalent callback in
|
* Wraps a deprecated {@link EventListener}, invoking its callback from the equivalent callback in
|
||||||
* {@link MediaSourceEventListener}.
|
* {@link MediaSourceEventListener}.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private static final class EventListenerWrapper extends DefaultMediaSourceEventListener {
|
private static final class EventListenerWrapper extends DefaultMediaSourceEventListener {
|
||||||
private final EventListener eventListener;
|
private final EventListener eventListener;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -197,6 +197,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
|
||||||
* @deprecated Use {@link Factory} instead.
|
* @deprecated Use {@link Factory} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public SingleSampleMediaSource(
|
public SingleSampleMediaSource(
|
||||||
Uri uri, DataSource.Factory dataSourceFactory, Format format, long durationUs) {
|
Uri uri, DataSource.Factory dataSourceFactory, Format format, long durationUs) {
|
||||||
this(
|
this(
|
||||||
|
|
@ -249,6 +250,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
|
||||||
* @deprecated Use {@link Factory} instead.
|
* @deprecated Use {@link Factory} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public SingleSampleMediaSource(
|
public SingleSampleMediaSource(
|
||||||
Uri uri,
|
Uri uri,
|
||||||
DataSource.Factory dataSourceFactory,
|
DataSource.Factory dataSourceFactory,
|
||||||
|
|
@ -333,6 +335,8 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
|
||||||
* Wraps a deprecated {@link EventListener}, invoking its callback from the equivalent callback in
|
* Wraps a deprecated {@link EventListener}, invoking its callback from the equivalent callback in
|
||||||
* {@link MediaSourceEventListener}.
|
* {@link MediaSourceEventListener}.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private static final class EventListenerWrapper extends DefaultMediaSourceEventListener {
|
private static final class EventListenerWrapper extends DefaultMediaSourceEventListener {
|
||||||
|
|
||||||
private final EventListener eventListener;
|
private final EventListener eventListener;
|
||||||
|
|
|
||||||
|
|
@ -1095,6 +1095,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
* directly passed to the player in ExoPlayerFactory.
|
* directly passed to the player in ExoPlayerFactory.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public DefaultTrackSelector(BandwidthMeter bandwidthMeter) {
|
public DefaultTrackSelector(BandwidthMeter bandwidthMeter) {
|
||||||
this(new AdaptiveTrackSelection.Factory(bandwidthMeter));
|
this(new AdaptiveTrackSelection.Factory(bandwidthMeter));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||||
* each mapped track, indexed by renderer, track group and track (in that order).
|
* each mapped track, indexed by renderer, track group and track (in that order).
|
||||||
* @param unmappedTrackGroups {@link TrackGroup}s not mapped to any renderer.
|
* @param unmappedTrackGroups {@link TrackGroup}s not mapped to any renderer.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
/* package */ MappedTrackInfo(
|
/* package */ MappedTrackInfo(
|
||||||
int[] rendererTrackTypes,
|
int[] rendererTrackTypes,
|
||||||
TrackGroupArray[] rendererTrackGroups,
|
TrackGroupArray[] rendererTrackGroups,
|
||||||
|
|
|
||||||
|
|
@ -226,6 +226,7 @@ public final class DataSpec {
|
||||||
* @param key {@link #key}.
|
* @param key {@link #key}.
|
||||||
* @param flags {@link #flags}.
|
* @param flags {@link #flags}.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public DataSpec(
|
public DataSpec(
|
||||||
Uri uri,
|
Uri uri,
|
||||||
@HttpMethod int httpMethod,
|
@HttpMethod int httpMethod,
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,7 @@ public final class DefaultDataSource implements DataSource {
|
||||||
* #addTransferListener(TransferListener)}.
|
* #addTransferListener(TransferListener)}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public DefaultDataSource(
|
public DefaultDataSource(
|
||||||
Context context,
|
Context context,
|
||||||
@Nullable TransferListener listener,
|
@Nullable TransferListener listener,
|
||||||
|
|
@ -167,6 +168,7 @@ public final class DefaultDataSource implements DataSource {
|
||||||
* #addTransferListener(TransferListener)}.
|
* #addTransferListener(TransferListener)}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public DefaultDataSource(
|
public DefaultDataSource(
|
||||||
Context context,
|
Context context,
|
||||||
@Nullable TransferListener listener,
|
@Nullable TransferListener listener,
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,11 @@ public final class DefaultDataSourceFactory implements Factory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DefaultDataSource createDataSource() {
|
public DefaultDataSource createDataSource() {
|
||||||
return new DefaultDataSource(context, listener, baseDataSourceFactory.createDataSource());
|
DefaultDataSource dataSource =
|
||||||
|
new DefaultDataSource(context, baseDataSourceFactory.createDataSource());
|
||||||
|
if (listener != null) {
|
||||||
|
dataSource.addTransferListener(listener);
|
||||||
|
}
|
||||||
|
return dataSource;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
|
||||||
* #addTransferListener(TransferListener)}.
|
* #addTransferListener(TransferListener)}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public DefaultHttpDataSource(
|
public DefaultHttpDataSource(
|
||||||
String userAgent,
|
String userAgent,
|
||||||
@Nullable Predicate<String> contentTypePredicate,
|
@Nullable Predicate<String> contentTypePredicate,
|
||||||
|
|
@ -190,6 +191,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
|
||||||
* #addTransferListener(TransferListener)}.
|
* #addTransferListener(TransferListener)}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public DefaultHttpDataSource(
|
public DefaultHttpDataSource(
|
||||||
String userAgent,
|
String userAgent,
|
||||||
@Nullable Predicate<String> contentTypePredicate,
|
@Nullable Predicate<String> contentTypePredicate,
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,17 @@ public final class DefaultHttpDataSourceFactory extends BaseFactory {
|
||||||
@Override
|
@Override
|
||||||
protected DefaultHttpDataSource createDataSourceInternal(
|
protected DefaultHttpDataSource createDataSourceInternal(
|
||||||
HttpDataSource.RequestProperties defaultRequestProperties) {
|
HttpDataSource.RequestProperties defaultRequestProperties) {
|
||||||
return new DefaultHttpDataSource(userAgent, null, listener, connectTimeoutMillis,
|
DefaultHttpDataSource dataSource =
|
||||||
readTimeoutMillis, allowCrossProtocolRedirects, defaultRequestProperties);
|
new DefaultHttpDataSource(
|
||||||
|
userAgent,
|
||||||
|
/* contentTypePredicate= */ null,
|
||||||
|
connectTimeoutMillis,
|
||||||
|
readTimeoutMillis,
|
||||||
|
allowCrossProtocolRedirects,
|
||||||
|
defaultRequestProperties);
|
||||||
|
if (listener != null) {
|
||||||
|
dataSource.addTransferListener(listener);
|
||||||
|
}
|
||||||
|
return dataSource;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,11 @@ public final class FileDataSourceFactory implements DataSource.Factory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataSource createDataSource() {
|
public DataSource createDataSource() {
|
||||||
return new FileDataSource(listener);
|
FileDataSource dataSource = new FileDataSource();
|
||||||
|
if (listener != null) {
|
||||||
|
dataSource.addTransferListener(listener);
|
||||||
|
}
|
||||||
|
return dataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ public final class UdpDataSource extends BaseDataSource {
|
||||||
* @deprecated Use {@link #UdpDataSource()} and {@link #addTransferListener(TransferListener)}.
|
* @deprecated Use {@link #UdpDataSource()} and {@link #addTransferListener(TransferListener)}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public UdpDataSource(@Nullable TransferListener listener) {
|
public UdpDataSource(@Nullable TransferListener listener) {
|
||||||
this(listener, DEFAULT_MAX_PACKET_SIZE);
|
this(listener, DEFAULT_MAX_PACKET_SIZE);
|
||||||
}
|
}
|
||||||
|
|
@ -107,6 +108,7 @@ public final class UdpDataSource extends BaseDataSource {
|
||||||
* @deprecated Use {@link #UdpDataSource(int)} and {@link #addTransferListener(TransferListener)}.
|
* @deprecated Use {@link #UdpDataSource(int)} and {@link #addTransferListener(TransferListener)}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public UdpDataSource(@Nullable TransferListener listener, int maxPacketSize) {
|
public UdpDataSource(@Nullable TransferListener listener, int maxPacketSize) {
|
||||||
this(listener, maxPacketSize, DEFAULT_SOCKET_TIMEOUT_MILLIS);
|
this(listener, maxPacketSize, DEFAULT_SOCKET_TIMEOUT_MILLIS);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ public class DrmInitDataTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Deprecated
|
@SuppressWarnings("deprecation")
|
||||||
public void testGetByUuid() {
|
public void testGetByUuid() {
|
||||||
// Basic matching.
|
// Basic matching.
|
||||||
DrmInitData testInitData = new DrmInitData(DATA_1, DATA_2);
|
DrmInitData testInitData = new DrmInitData(DATA_1, DATA_2);
|
||||||
|
|
@ -130,6 +130,7 @@ public class DrmInitDataTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void testSchemeDatasWithSameUuid() {
|
public void testSchemeDatasWithSameUuid() {
|
||||||
DrmInitData testInitData = new DrmInitData(DATA_1, DATA_1B);
|
DrmInitData testInitData = new DrmInitData(DATA_1, DATA_1B);
|
||||||
assertThat(testInitData.schemeDataCount).isEqualTo(2);
|
assertThat(testInitData.schemeDataCount).isEqualTo(2);
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ public final class AdaptiveTrackSelectionTest {
|
||||||
BandwidthMeter initialBandwidthMeter = mock(BandwidthMeter.class);
|
BandwidthMeter initialBandwidthMeter = mock(BandwidthMeter.class);
|
||||||
BandwidthMeter injectedBandwidthMeter = mock(BandwidthMeter.class);
|
BandwidthMeter injectedBandwidthMeter = mock(BandwidthMeter.class);
|
||||||
Format format = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
|
Format format = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
AdaptiveTrackSelection adaptiveTrackSelection =
|
AdaptiveTrackSelection adaptiveTrackSelection =
|
||||||
new AdaptiveTrackSelection.Factory(initialBandwidthMeter)
|
new AdaptiveTrackSelection.Factory(initialBandwidthMeter)
|
||||||
.createTrackSelection(new TrackGroup(format), injectedBandwidthMeter, /* tracks= */ 0);
|
.createTrackSelection(new TrackGroup(format), injectedBandwidthMeter, /* tracks= */ 0);
|
||||||
|
|
|
||||||
|
|
@ -309,6 +309,7 @@ public final class HlsMediaSource extends BaseMediaSource
|
||||||
* @deprecated Use {@link Factory} instead.
|
* @deprecated Use {@link Factory} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public HlsMediaSource(
|
public HlsMediaSource(
|
||||||
Uri manifestUri,
|
Uri manifestUri,
|
||||||
DataSource.Factory dataSourceFactory,
|
DataSource.Factory dataSourceFactory,
|
||||||
|
|
@ -334,6 +335,7 @@ public final class HlsMediaSource extends BaseMediaSource
|
||||||
* @deprecated Use {@link Factory} instead.
|
* @deprecated Use {@link Factory} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public HlsMediaSource(
|
public HlsMediaSource(
|
||||||
Uri manifestUri,
|
Uri manifestUri,
|
||||||
DataSource.Factory dataSourceFactory,
|
DataSource.Factory dataSourceFactory,
|
||||||
|
|
@ -364,6 +366,7 @@ public final class HlsMediaSource extends BaseMediaSource
|
||||||
* @deprecated Use {@link Factory} instead.
|
* @deprecated Use {@link Factory} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public HlsMediaSource(
|
public HlsMediaSource(
|
||||||
Uri manifestUri,
|
Uri manifestUri,
|
||||||
HlsDataSourceFactory dataSourceFactory,
|
HlsDataSourceFactory dataSourceFactory,
|
||||||
|
|
|
||||||
|
|
@ -330,6 +330,7 @@ public final class SsMediaSource extends BaseMediaSource
|
||||||
* @deprecated Use {@link Factory} instead.
|
* @deprecated Use {@link Factory} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public SsMediaSource(
|
public SsMediaSource(
|
||||||
SsManifest manifest,
|
SsManifest manifest,
|
||||||
SsChunkSource.Factory chunkSourceFactory,
|
SsChunkSource.Factory chunkSourceFactory,
|
||||||
|
|
@ -388,6 +389,7 @@ public final class SsMediaSource extends BaseMediaSource
|
||||||
* @deprecated Use {@link Factory} instead.
|
* @deprecated Use {@link Factory} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public SsMediaSource(
|
public SsMediaSource(
|
||||||
Uri manifestUri,
|
Uri manifestUri,
|
||||||
DataSource.Factory manifestDataSourceFactory,
|
DataSource.Factory manifestDataSourceFactory,
|
||||||
|
|
@ -420,6 +422,7 @@ public final class SsMediaSource extends BaseMediaSource
|
||||||
* @deprecated Use {@link Factory} instead.
|
* @deprecated Use {@link Factory} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public SsMediaSource(
|
public SsMediaSource(
|
||||||
Uri manifestUri,
|
Uri manifestUri,
|
||||||
DataSource.Factory manifestDataSourceFactory,
|
DataSource.Factory manifestDataSourceFactory,
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,13 @@ public class PlaybackControlView extends PlayerControlView {
|
||||||
public interface VisibilityListener
|
public interface VisibilityListener
|
||||||
extends com.google.android.exoplayer2.ui.PlayerControlView.VisibilityListener {}
|
extends com.google.android.exoplayer2.ui.PlayerControlView.VisibilityListener {}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private static final class DefaultControlDispatcher
|
private static final class DefaultControlDispatcher
|
||||||
extends com.google.android.exoplayer2.DefaultControlDispatcher implements ControlDispatcher {}
|
extends com.google.android.exoplayer2.DefaultControlDispatcher implements ControlDispatcher {}
|
||||||
/** @deprecated Use {@link com.google.android.exoplayer2.DefaultControlDispatcher}. */
|
/** @deprecated Use {@link com.google.android.exoplayer2.DefaultControlDispatcher}. */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public static final ControlDispatcher DEFAULT_CONTROL_DISPATCHER = new DefaultControlDispatcher();
|
public static final ControlDispatcher DEFAULT_CONTROL_DISPATCHER = new DefaultControlDispatcher();
|
||||||
|
|
||||||
/** The default fast forward increment, in milliseconds. */
|
/** The default fast forward increment, in milliseconds. */
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import android.content.Context;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||||
|
|
||||||
/** @deprecated Use {@link PlayerView}. */
|
/** @deprecated Use {@link PlayerView}. */
|
||||||
|
|
@ -45,7 +46,10 @@ public final class SimpleExoPlayerView extends PlayerView {
|
||||||
* @param player The player whose target view is being switched.
|
* @param player The player whose target view is being switched.
|
||||||
* @param oldPlayerView The old view to detach from the player.
|
* @param oldPlayerView The old view to detach from the player.
|
||||||
* @param newPlayerView The new view to attach to the player.
|
* @param newPlayerView The new view to attach to the player.
|
||||||
|
* @deprecated Use {@link PlayerView#switchTargetView(Player, PlayerView, PlayerView)} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public static void switchTargetView(
|
public static void switchTargetView(
|
||||||
@NonNull SimpleExoPlayer player,
|
@NonNull SimpleExoPlayer player,
|
||||||
@Nullable SimpleExoPlayerView oldPlayerView,
|
@Nullable SimpleExoPlayerView oldPlayerView,
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||||
import com.google.android.exoplayer2.source.chunk.ChunkSampleStream;
|
import com.google.android.exoplayer2.source.chunk.ChunkSampleStream;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
||||||
import com.google.android.exoplayer2.upstream.Allocator;
|
import com.google.android.exoplayer2.upstream.Allocator;
|
||||||
|
import com.google.android.exoplayer2.upstream.DefaultLoadErrorHandlingPolicy;
|
||||||
import com.google.android.exoplayer2.upstream.TransferListener;
|
import com.google.android.exoplayer2.upstream.TransferListener;
|
||||||
import com.google.android.exoplayer2.util.MimeTypes;
|
import com.google.android.exoplayer2.util.MimeTypes;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -142,13 +143,13 @@ public class FakeAdaptiveMediaPeriod extends FakeMediaPeriod
|
||||||
chunkSourceFactory.createChunkSource(trackSelection, durationUs, transferListener);
|
chunkSourceFactory.createChunkSource(trackSelection, durationUs, transferListener);
|
||||||
return new ChunkSampleStream<>(
|
return new ChunkSampleStream<>(
|
||||||
MimeTypes.getTrackType(trackSelection.getSelectedFormat().sampleMimeType),
|
MimeTypes.getTrackType(trackSelection.getSelectedFormat().sampleMimeType),
|
||||||
null,
|
/* embeddedTrackTypes= */ null,
|
||||||
null,
|
/* embeddedTrackFormats= */ null,
|
||||||
chunkSource,
|
chunkSource,
|
||||||
this,
|
/* callback= */ this,
|
||||||
allocator,
|
allocator,
|
||||||
0,
|
/* positionUs= */ 0,
|
||||||
3,
|
new DefaultLoadErrorHandlingPolicy(/* minimumLoadableRetryCount= */ 3),
|
||||||
eventDispatcher);
|
eventDispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,9 @@ public class FakeTrackSelector extends DefaultTrackSelector {
|
||||||
int[] rendererMixedMimeTypeAdaptationSupports,
|
int[] rendererMixedMimeTypeAdaptationSupports,
|
||||||
Parameters params)
|
Parameters params)
|
||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
TrackSelection[] selections = new TrackSelection[mappedTrackInfo.length];
|
int rendererCount = mappedTrackInfo.getRendererCount();
|
||||||
for (int i = 0; i < mappedTrackInfo.length; i++) {
|
TrackSelection[] selections = new TrackSelection[rendererCount];
|
||||||
|
for (int i = 0; i < rendererCount; i++) {
|
||||||
TrackGroupArray trackGroupArray = mappedTrackInfo.getTrackGroups(i);
|
TrackGroupArray trackGroupArray = mappedTrackInfo.getTrackGroups(i);
|
||||||
boolean hasTracks = trackGroupArray.length > 0;
|
boolean hasTracks = trackGroupArray.length > 0;
|
||||||
selections[i] = hasTracks ? reuseOrCreateTrackSelection(trackGroupArray.get(0)) : null;
|
selections[i] = hasTracks ? reuseOrCreateTrackSelection(trackGroupArray.get(0)) : null;
|
||||||
|
|
|
||||||
|
|
@ -190,11 +190,15 @@ public abstract class StubExoPlayer implements ExoPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void sendMessages(ExoPlayerMessage... messages) {
|
public void sendMessages(ExoPlayerMessage... messages) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void blockingSendMessages(ExoPlayerMessage... messages) {
|
public void blockingSendMessages(ExoPlayerMessage... messages) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue