Return the removed media source from ConcatenatingMediaSource.removeMediaSource

PiperOrigin-RevId: 260681773
This commit is contained in:
aquilescanta 2019-07-30 11:21:52 +01:00 committed by Oliver Woodman
parent 58006ac3ad
commit 40926618ad

View file

@ -263,9 +263,12 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource<MediaSo
* *
* @param index The index at which the media source will be removed. This index must be in the * @param index The index at which the media source will be removed. This index must be in the
* range of 0 &lt;= index &lt; {@link #getSize()}. * range of 0 &lt;= index &lt; {@link #getSize()}.
* @return The removed {@link MediaSource}.
*/ */
public synchronized void removeMediaSource(int index) { public synchronized MediaSource removeMediaSource(int index) {
MediaSource removedMediaSource = getMediaSource(index);
removePublicMediaSources(index, index + 1, /* handler= */ null, /* onCompletionAction= */ null); removePublicMediaSources(index, index + 1, /* handler= */ null, /* onCompletionAction= */ null);
return removedMediaSource;
} }
/** /**
@ -282,10 +285,13 @@ public final class ConcatenatingMediaSource extends CompositeMediaSource<MediaSo
* @param handler The {@link Handler} to run {@code onCompletionAction}. * @param handler The {@link Handler} to run {@code onCompletionAction}.
* @param onCompletionAction A {@link Runnable} which is executed immediately after the media * @param onCompletionAction A {@link Runnable} which is executed immediately after the media
* source has been removed from the playlist. * source has been removed from the playlist.
* @return The removed {@link MediaSource}.
*/ */
public synchronized void removeMediaSource( public synchronized MediaSource removeMediaSource(
int index, Handler handler, Runnable onCompletionAction) { int index, Handler handler, Runnable onCompletionAction) {
MediaSource removedMediaSource = getMediaSource(index);
removePublicMediaSources(index, index + 1, handler, onCompletionAction); removePublicMediaSources(index, index + 1, handler, onCompletionAction);
return removedMediaSource;
} }
/** /**