mirror of
https://github.com/androidx/media.git
synced 2025-05-07 15:40:37 +08:00
Cleanup recent merged pull requests
This commit is contained in:
parent
071155d219
commit
32bd69d4b2
@ -44,9 +44,10 @@
|
||||
on ExoPlayer via its source code rather than an AAR may need to add
|
||||
`compileOptions { targetCompatibility JavaVersion.VERSION_1_8 }` to their
|
||||
gradle settings to ensure bytecode compatibility.
|
||||
* Add support for lazy preparation of playlist media sources in
|
||||
`ConcatenatingMediaSource`
|
||||
([#3972](https://github.com/google/ExoPlayer/issues/3972)).
|
||||
* ConcatenatingMediaSource:
|
||||
* Add support for lazy preparation of playlist media sources
|
||||
([#3972](https://github.com/google/ExoPlayer/issues/3972)).
|
||||
* Add support for range removal with `removeMediaSourceRange` methods.
|
||||
* `BandwidthMeter` management:
|
||||
* Pass `BandwidthMeter` directly to `ExoPlayerFactory` instead of
|
||||
`TrackSelection.Factory` and `DataSource.Factory`. May also be omitted to
|
||||
@ -108,6 +109,9 @@
|
||||
* IMA: Improve handling of consecutive empty ad groups
|
||||
([#4030](https://github.com/google/ExoPlayer/issues/4030)),
|
||||
([#4280](https://github.com/google/ExoPlayer/issues/4280)).
|
||||
* Add option to show buffering view when playWhenReady is false
|
||||
([#4304](https://github.com/google/ExoPlayer/issues/4304)).
|
||||
* Allow any `Drawable` to be used as `PlayerView` default artwork.
|
||||
|
||||
### 2.8.3 ###
|
||||
|
||||
|
@ -265,8 +265,8 @@ public class ConcatenatingMediaSource extends CompositeMediaSource<MediaSourceHo
|
||||
* <p>Note: If you want to move the instance, it's preferable to use {@link #moveMediaSource(int,
|
||||
* int)} instead.
|
||||
*
|
||||
* <p>Note: If you want to remove a set of contiguous sources, it's preferable to use
|
||||
* {@link #removeMediaSourceRange(int, int)} instead.
|
||||
* <p>Note: If you want to remove a set of contiguous sources, it's preferable to use {@link
|
||||
* #removeMediaSourceRange(int, int)} instead.
|
||||
*
|
||||
* @param index The index at which the media source will be removed. This index must be in the
|
||||
* range of 0 <= index < {@link #getSize()}.
|
||||
@ -281,8 +281,8 @@ public class ConcatenatingMediaSource extends CompositeMediaSource<MediaSourceHo
|
||||
* <p>Note: If you want to move the instance, it's preferable to use {@link #moveMediaSource(int,
|
||||
* int, Runnable)} instead.
|
||||
*
|
||||
* <p>Note: If you want to remove a set of contiguous sources, it's preferable to use
|
||||
* {@link #removeMediaSourceRange(int, int, Runnable)} instead.
|
||||
* <p>Note: If you want to remove a set of contiguous sources, it's preferable to use {@link
|
||||
* #removeMediaSourceRange(int, int, Runnable)} instead.
|
||||
*
|
||||
* @param index The index at which the media source will be removed. This index must be in the
|
||||
* range of 0 <= index < {@link #getSize()}.
|
||||
@ -307,15 +307,15 @@ public class ConcatenatingMediaSource extends CompositeMediaSource<MediaSourceHo
|
||||
* Removes a range of {@link MediaSource}s from the playlist, by specifying an initial index
|
||||
* (included) and a final index (excluded).
|
||||
*
|
||||
* <p>Note: when specified range is empty, no actual media source is removed and no exception
|
||||
* is thrown.
|
||||
* <p>Note: when specified range is empty, no actual media source is removed and no exception is
|
||||
* thrown.
|
||||
*
|
||||
* @param fromIndex The initial range index, pointing to the first media source that will be
|
||||
* removed. This index must be in the range of 0 <= index <= {@link #getSize()}.
|
||||
* @param toIndex The final range index, pointing to the first media source that will be left
|
||||
* untouched. This index must be in the range of 0 <= index <= {@link #getSize()}.
|
||||
* @throws IndexOutOfBoundsException When the range is malformed, i.e. {@code fromIndex} <
|
||||
* 0, {@code toIndex} > {@link #getSize()}, {@code fromIndex} > {@code toIndex}
|
||||
* @throws IndexOutOfBoundsException When the range is malformed, i.e. {@code fromIndex} < 0,
|
||||
* {@code toIndex} > {@link #getSize()}, {@code fromIndex} > {@code toIndex}
|
||||
*/
|
||||
public final synchronized void removeMediaSourceRange(int fromIndex, int toIndex) {
|
||||
removeMediaSourceRange(fromIndex, toIndex, null);
|
||||
@ -325,8 +325,8 @@ public class ConcatenatingMediaSource extends CompositeMediaSource<MediaSourceHo
|
||||
* Removes a range of {@link MediaSource}s from the playlist, by specifying an initial index
|
||||
* (included) and a final index (excluded), and executes a custom action on completion.
|
||||
*
|
||||
* <p>Note: when specified range is empty, no actual media source is removed and no exception
|
||||
* is thrown.
|
||||
* <p>Note: when specified range is empty, no actual media source is removed and no exception is
|
||||
* thrown.
|
||||
*
|
||||
* @param fromIndex The initial range index, pointing to the first media source that will be
|
||||
* removed. This index must be in the range of 0 <= index <= {@link #getSize()}.
|
||||
@ -334,11 +334,11 @@ public class ConcatenatingMediaSource extends CompositeMediaSource<MediaSourceHo
|
||||
* untouched. This index must be in the range of 0 <= index <= {@link #getSize()}.
|
||||
* @param actionOnCompletion A {@link Runnable} which is executed immediately after the media
|
||||
* source range has been removed from the playlist.
|
||||
* @throws IndexOutOfBoundsException When the range is malformed, i.e. {@code fromIndex} <
|
||||
* 0, {@code toIndex} > {@link #getSize()}, {@code fromIndex} > {@code toIndex}
|
||||
* @throws IndexOutOfBoundsException When the range is malformed, i.e. {@code fromIndex} < 0,
|
||||
* {@code toIndex} > {@link #getSize()}, {@code fromIndex} > {@code toIndex}
|
||||
*/
|
||||
public final synchronized void removeMediaSourceRange(
|
||||
int fromIndex, int toIndex, @Nullable Runnable actionOnCompletion) {
|
||||
int fromIndex, int toIndex, @Nullable Runnable actionOnCompletion) {
|
||||
Util.removeRange(mediaSourcesPublic, fromIndex, toIndex);
|
||||
if (fromIndex == toIndex) {
|
||||
if (actionOnCompletion != null) {
|
||||
|
@ -37,8 +37,8 @@ import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* A special purpose extractor for WebVTT content in HLS.
|
||||
* <p>
|
||||
* This extractor passes through non-empty WebVTT files untouched, however derives the correct
|
||||
*
|
||||
* <p>This extractor passes through non-empty WebVTT files untouched, however derives the correct
|
||||
* sample timestamp for each by sniffing the X-TIMESTAMP-MAP header along with the start timestamp
|
||||
* of the first cue header. Empty WebVTT files are not passed through, since it's not possible to
|
||||
* derive a sample timestamp in this case.
|
||||
|
@ -25,9 +25,9 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.RectF;
|
||||
import android.support.annotation.IntDef;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.IntDef;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
@ -89,7 +89,7 @@ import java.util.List;
|
||||
* <li><b>{@code default_artwork}</b> - Default artwork to use if no artwork available in audio
|
||||
* streams.
|
||||
* <ul>
|
||||
* <li>Corresponding method: {@link #setDefaultArtwork(Bitmap)}
|
||||
* <li>Corresponding method: {@link #setDefaultArtwork(Drawable)}
|
||||
* <li>Default: {@code null}
|
||||
* </ul>
|
||||
* <li><b>{@code use_controller}</b> - Whether the playback controls can be shown.
|
||||
@ -116,10 +116,10 @@ import java.util.List;
|
||||
* <li>Default: {@code true}
|
||||
* </ul>
|
||||
* <li><b>{@code show_buffering}</b> - Whether the buffering spinner is displayed when the player
|
||||
* is buffering.
|
||||
* is buffering. Valid values are {@code never}, {@code when_playing} and {@code always}.
|
||||
* <ul>
|
||||
* <li>Corresponding method: {@link #setShowBuffering(boolean)}
|
||||
* <li>Default: {@code false}
|
||||
* <li>Corresponding method: {@link #setShowBuffering(int)}
|
||||
* <li>Default: {@code never}
|
||||
* </ul>
|
||||
* <li><b>{@code resize_mode}</b> - Controls how video and album art is resized within the view.
|
||||
* Valid values are {@code fit}, {@code fixed_width}, {@code fixed_height} and {@code fill}.
|
||||
@ -243,13 +243,22 @@ public class PlayerView extends FrameLayout {
|
||||
private static final int SURFACE_TYPE_TEXTURE_VIEW = 2;
|
||||
private static final int SURFACE_TYPE_MONO360_VIEW = 3;
|
||||
|
||||
public static final int SHOW_BUFFERING_NEVER = 0;
|
||||
public static final int SHOW_BUFFERING_ALWAYS = 1;
|
||||
public static final int SHOW_BUFFERING_WHEN_PLAYING = 2;
|
||||
|
||||
/** Determines when the buffering view is shown. */
|
||||
@IntDef({SHOW_BUFFERING_NEVER, SHOW_BUFFERING_WHEN_PLAYING, SHOW_BUFFERING_ALWAYS})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ShowBuffering {}
|
||||
/** The buffering view is never shown. */
|
||||
public static final int SHOW_BUFFERING_NEVER = 0;
|
||||
/**
|
||||
* The buffering view is shown when the player is in the {@link Player#STATE_BUFFERING buffering}
|
||||
* state and {@link Player#getPlayWhenReady() playWhenReady} is {@code true}.
|
||||
*/
|
||||
public static final int SHOW_BUFFERING_WHEN_PLAYING = 1;
|
||||
/**
|
||||
* The buffering view is always shown when the player is in the {@link Player#STATE_BUFFERING
|
||||
* buffering} state.
|
||||
*/
|
||||
public static final int SHOW_BUFFERING_ALWAYS = 2;
|
||||
|
||||
private final AspectRatioFrameLayout contentFrame;
|
||||
private final View shutterView;
|
||||
@ -265,7 +274,7 @@ public class PlayerView extends FrameLayout {
|
||||
private Player player;
|
||||
private boolean useController;
|
||||
private boolean useArtwork;
|
||||
private Drawable defaultArtwork;
|
||||
private @Nullable Drawable defaultArtwork;
|
||||
private @ShowBuffering int showBuffering;
|
||||
private boolean keepContentOnPlayerReset;
|
||||
private @Nullable ErrorMessageProvider<? super ExoPlaybackException> errorMessageProvider;
|
||||
@ -598,8 +607,9 @@ public class PlayerView extends FrameLayout {
|
||||
* @deprecated use (@link {@link #setDefaultArtwork(Drawable)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setDefaultArtwork(Bitmap defaultArtwork) {
|
||||
setDefaultArtwork(new BitmapDrawable(getResources(), defaultArtwork));
|
||||
public void setDefaultArtwork(@Nullable Bitmap defaultArtwork) {
|
||||
setDefaultArtwork(
|
||||
defaultArtwork == null ? null : new BitmapDrawable(getResources(), defaultArtwork));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -608,7 +618,7 @@ public class PlayerView extends FrameLayout {
|
||||
*
|
||||
* @param defaultArtwork the default artwork to display
|
||||
*/
|
||||
public void setDefaultArtwork(Drawable defaultArtwork) {
|
||||
public void setDefaultArtwork(@Nullable Drawable defaultArtwork) {
|
||||
if (this.defaultArtwork != defaultArtwork) {
|
||||
this.defaultArtwork = defaultArtwork;
|
||||
updateForCurrentTrackSelections(/* isNewPlayer= */ false);
|
||||
@ -682,7 +692,6 @@ public class PlayerView extends FrameLayout {
|
||||
* buffering spinner is not displayed by default.
|
||||
*
|
||||
* @deprecated Use {@link #setShowBuffering(int)}
|
||||
*
|
||||
* @param showBuffering Whether the buffering icon is displayed
|
||||
*/
|
||||
@Deprecated
|
||||
@ -692,15 +701,11 @@ public class PlayerView extends FrameLayout {
|
||||
|
||||
/**
|
||||
* Sets whether a buffering spinner is displayed when the player is in the buffering state. The
|
||||
* buffering spinner is not displayed by default (initial value {@link #SHOW_BUFFERING_NEVER})
|
||||
* buffering spinner is not displayed by default.
|
||||
*
|
||||
* <p><ul>
|
||||
* <li>{@link #SHOW_BUFFERING_ALWAYS} displayed always when buffering
|
||||
* <li>{@link #SHOW_BUFFERING_NEVER} not displayed at all
|
||||
* <li>{@link #SHOW_BUFFERING_WHEN_PLAYING} displayed only when playing and buffering
|
||||
* </ul></p>
|
||||
*
|
||||
* @param showBuffering Buffering strategy that defines when the buffering icon is displayed
|
||||
* @param showBuffering The mode that defines when the buffering spinner is displayed. One of
|
||||
* {@link #SHOW_BUFFERING_NEVER}, {@link #SHOW_BUFFERING_WHEN_PLAYING} and
|
||||
* {@link #SHOW_BUFFERING_ALWAYS}.
|
||||
*/
|
||||
public void setShowBuffering(@ShowBuffering int showBuffering) {
|
||||
if (this.showBuffering != showBuffering) {
|
||||
@ -1153,14 +1158,20 @@ public class PlayerView extends FrameLayout {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean setDrawableArtwork(Drawable drawable) {
|
||||
if(drawable != null) {
|
||||
artworkView.setImageDrawable(drawable);
|
||||
if(contentFrame != null) {
|
||||
contentFrame.setAspectRatio(0);
|
||||
private boolean setDrawableArtwork(@Nullable Drawable drawable) {
|
||||
if (drawable != null) {
|
||||
int drawableWidth = drawable.getIntrinsicWidth();
|
||||
int drawableHeight = drawable.getIntrinsicHeight();
|
||||
if (drawableWidth > 0 && drawableHeight > 0) {
|
||||
if (contentFrame != null) {
|
||||
contentFrame.setAspectRatio((float) drawableWidth / drawableHeight);
|
||||
}
|
||||
artworkView.setImageDrawable(drawable);
|
||||
artworkView.setVisibility(VISIBLE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void hideArtwork() {
|
||||
@ -1178,23 +1189,11 @@ public class PlayerView extends FrameLayout {
|
||||
|
||||
private void updateBuffering() {
|
||||
if (bufferingView != null) {
|
||||
|
||||
boolean showBufferingSpinner = false;
|
||||
|
||||
if (player != null && player.getPlaybackState() == Player.STATE_BUFFERING) {
|
||||
switch (showBuffering) {
|
||||
case SHOW_BUFFERING_ALWAYS:
|
||||
showBufferingSpinner = true;
|
||||
break;
|
||||
case SHOW_BUFFERING_NEVER:
|
||||
showBufferingSpinner = false;
|
||||
break;
|
||||
case SHOW_BUFFERING_WHEN_PLAYING:
|
||||
showBufferingSpinner = player.getPlayWhenReady();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
boolean showBufferingSpinner =
|
||||
player != null
|
||||
&& player.getPlaybackState() == Player.STATE_BUFFERING
|
||||
&& (showBuffering == SHOW_BUFFERING_ALWAYS
|
||||
|| (showBuffering == SHOW_BUFFERING_WHEN_PLAYING && player.getPlayWhenReady()));
|
||||
bufferingView.setVisibility(showBufferingSpinner ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user