mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Merge branch 'dev-v2' into dev-v2-r2.12.0
This commit is contained in:
commit
9778898b47
4 changed files with 24 additions and 8 deletions
|
|
@ -8,7 +8,8 @@
|
||||||
([#6161](https://github.com/google/ExoPlayer/issues/6161)). The
|
([#6161](https://github.com/google/ExoPlayer/issues/6161)). The
|
||||||
new methods for playlist manipulation are `setMediaItem(s)`,
|
new methods for playlist manipulation are `setMediaItem(s)`,
|
||||||
`addMediaItem(s)`, `moveMediaItem(s)`, `removeMediaItem(s)` and
|
`addMediaItem(s)`, `moveMediaItem(s)`, `removeMediaItem(s)` and
|
||||||
`clearMediaItems`.
|
`clearMediaItems`. This API should be used instead of
|
||||||
|
`ConcatenatingMediaSource` in most cases.
|
||||||
* Add `getCurrentMediaItem` for getting the currently playing item
|
* Add `getCurrentMediaItem` for getting the currently playing item
|
||||||
in the playlist.
|
in the playlist.
|
||||||
* Add `EventListener.onMediaItemTransition` to report when
|
* Add `EventListener.onMediaItemTransition` to report when
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
private final BandwidthMeter bandwidthMeter;
|
private final BandwidthMeter bandwidthMeter;
|
||||||
private final HandlerWrapper handler;
|
private final HandlerWrapper handler;
|
||||||
private final HandlerThread internalPlaybackThread;
|
private final HandlerThread internalPlaybackThread;
|
||||||
|
private final Looper playbackLooper;
|
||||||
private final Timeline.Window window;
|
private final Timeline.Window window;
|
||||||
private final Timeline.Period period;
|
private final Timeline.Period period;
|
||||||
private final long backBufferDurationUs;
|
private final long backBufferDurationUs;
|
||||||
|
|
@ -252,7 +253,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
// not normally change to this priority" is incorrect.
|
// not normally change to this priority" is incorrect.
|
||||||
internalPlaybackThread = new HandlerThread("ExoPlayer:Playback", Process.THREAD_PRIORITY_AUDIO);
|
internalPlaybackThread = new HandlerThread("ExoPlayer:Playback", Process.THREAD_PRIORITY_AUDIO);
|
||||||
internalPlaybackThread.start();
|
internalPlaybackThread.start();
|
||||||
handler = clock.createHandler(internalPlaybackThread.getLooper(), this);
|
playbackLooper = internalPlaybackThread.getLooper();
|
||||||
|
handler = clock.createHandler(playbackLooper, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void experimentalSetReleaseTimeoutMs(long releaseTimeoutMs) {
|
public void experimentalSetReleaseTimeoutMs(long releaseTimeoutMs) {
|
||||||
|
|
@ -403,7 +405,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Looper getPlaybackLooper() {
|
public Looper getPlaybackLooper() {
|
||||||
return internalPlaybackThread.getLooper();
|
return playbackLooper;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Playlist.PlaylistInfoRefreshListener implementation.
|
// Playlist.PlaylistInfoRefreshListener implementation.
|
||||||
|
|
@ -1365,7 +1367,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessageToTarget(PlayerMessage message) throws ExoPlaybackException {
|
private void sendMessageToTarget(PlayerMessage message) throws ExoPlaybackException {
|
||||||
if (message.getHandler().getLooper() == handler.getLooper()) {
|
if (message.getHandler().getLooper() == playbackLooper) {
|
||||||
deliverMessage(message);
|
deliverMessage(message);
|
||||||
if (playbackInfo.playbackState == Player.STATE_READY
|
if (playbackInfo.playbackState == Player.STATE_READY
|
||||||
|| playbackInfo.playbackState == Player.STATE_BUFFERING) {
|
|| playbackInfo.playbackState == Player.STATE_BUFFERING) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# Constructor method accessed via reflection in TrackSelectionDialogBuilder
|
# Constructor method accessed via reflection in TrackSelectionDialogBuilder
|
||||||
-dontnote androidx.appcompat.app.AlertDialog.Builder
|
-dontnote androidx.appcompat.app.AlertDialog.Builder
|
||||||
-keepclassmembers class androidx.appcompat.app.AlertDialog$Builder {
|
-keepclassmembers class androidx.appcompat.app.AlertDialog$Builder {
|
||||||
<init>(android.content.Context);
|
<init>(android.content.Context, int);
|
||||||
public android.content.Context getContext();
|
public android.content.Context getContext();
|
||||||
public androidx.appcompat.app.AlertDialog$Builder setTitle(java.lang.CharSequence);
|
public androidx.appcompat.app.AlertDialog$Builder setTitle(java.lang.CharSequence);
|
||||||
public androidx.appcompat.app.AlertDialog$Builder setView(android.view.View);
|
public androidx.appcompat.app.AlertDialog$Builder setView(android.view.View);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import android.content.DialogInterface;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.StyleRes;
|
||||||
import com.google.android.exoplayer2.source.TrackGroupArray;
|
import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
||||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector.SelectionOverride;
|
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector.SelectionOverride;
|
||||||
|
|
@ -49,6 +50,7 @@ public final class TrackSelectionDialogBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
|
@StyleRes private int themeResId;
|
||||||
private final CharSequence title;
|
private final CharSequence title;
|
||||||
private final MappedTrackInfo mappedTrackInfo;
|
private final MappedTrackInfo mappedTrackInfo;
|
||||||
private final int rendererIndex;
|
private final int rendererIndex;
|
||||||
|
|
@ -121,6 +123,17 @@ public final class TrackSelectionDialogBuilder {
|
||||||
newOverrides.isEmpty() ? null : newOverrides.get(0)));
|
newOverrides.isEmpty() ? null : newOverrides.get(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the resource ID of the theme used to inflate this dialog.
|
||||||
|
*
|
||||||
|
* @param themeResId The resource ID of the theme.
|
||||||
|
* @return This builder, for convenience.
|
||||||
|
*/
|
||||||
|
public TrackSelectionDialogBuilder setTheme(@StyleRes int themeResId) {
|
||||||
|
this.themeResId = themeResId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the selection is initially shown as disabled.
|
* Sets whether the selection is initially shown as disabled.
|
||||||
*
|
*
|
||||||
|
|
@ -214,7 +227,7 @@ public final class TrackSelectionDialogBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dialog buildForPlatform() {
|
private Dialog buildForPlatform() {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context, themeResId);
|
||||||
|
|
||||||
// Inflate with the builder's context to ensure the correct style is used.
|
// Inflate with the builder's context to ensure the correct style is used.
|
||||||
LayoutInflater dialogInflater = LayoutInflater.from(builder.getContext());
|
LayoutInflater dialogInflater = LayoutInflater.from(builder.getContext());
|
||||||
|
|
@ -238,8 +251,8 @@ public final class TrackSelectionDialogBuilder {
|
||||||
// the APK size even with shrinking. See https://issuetracker.google.com/161514204.
|
// the APK size even with shrinking. See https://issuetracker.google.com/161514204.
|
||||||
// LINT.IfChange
|
// LINT.IfChange
|
||||||
Class<?> builderClazz = Class.forName("androidx.appcompat.app.AlertDialog$Builder");
|
Class<?> builderClazz = Class.forName("androidx.appcompat.app.AlertDialog$Builder");
|
||||||
Constructor<?> builderConstructor = builderClazz.getConstructor(Context.class);
|
Constructor<?> builderConstructor = builderClazz.getConstructor(Context.class, int.class);
|
||||||
Object builder = builderConstructor.newInstance(context);
|
Object builder = builderConstructor.newInstance(context, themeResId);
|
||||||
|
|
||||||
// Inflate with the builder's context to ensure the correct style is used.
|
// Inflate with the builder's context to ensure the correct style is used.
|
||||||
Context builderContext = (Context) builderClazz.getMethod("getContext").invoke(builder);
|
Context builderContext = (Context) builderClazz.getMethod("getContext").invoke(builder);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue