mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Don't consider switching tracks as "joining".
I'm not really sure how best to document this in TrackRenderer; it's a bit of a weird feature. For now, I've gone with the vague approach. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=112150939
This commit is contained in:
parent
317842a6b7
commit
be2aedbd53
2 changed files with 5 additions and 7 deletions
|
|
@ -640,7 +640,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
if (shouldEnable) {
|
||||
// Re-enable the renderer with the newly selected track.
|
||||
boolean playing = playWhenReady && state == ExoPlayer.STATE_READY;
|
||||
renderer.enable(trackIndex, positionUs, playing);
|
||||
// Consider as joining if the renderer was previously disabled, but not when switching tracks.
|
||||
boolean joining = !isEnabled && playing;
|
||||
renderer.enable(trackIndex, positionUs, joining);
|
||||
enabledRenderers.add(renderer);
|
||||
if (playing) {
|
||||
renderer.start();
|
||||
|
|
|
|||
|
|
@ -150,9 +150,7 @@ public abstract class TrackRenderer implements ExoPlayerComponent {
|
|||
*
|
||||
* @param track The track for which the renderer is being enabled.
|
||||
* @param positionUs The player's current position.
|
||||
* @param joining Whether this renderer is being enabled to join an ongoing playback. If true
|
||||
* then {@link #start} must be called immediately after this method returns (unless a
|
||||
* {@link ExoPlaybackException} is thrown).
|
||||
* @param joining Whether this renderer is being enabled to join an ongoing playback.
|
||||
* @throws ExoPlaybackException If an error occurs.
|
||||
*/
|
||||
/* package */ final void enable(int track, long positionUs, boolean joining)
|
||||
|
|
@ -169,9 +167,7 @@ public abstract class TrackRenderer implements ExoPlayerComponent {
|
|||
*
|
||||
* @param track The track for which the renderer is being enabled.
|
||||
* @param positionUs The player's current position.
|
||||
* @param joining Whether this renderer is being enabled to join an ongoing playback. If true
|
||||
* then {@link #onStarted} is guaranteed to be called immediately after this method returns
|
||||
* (unless a {@link ExoPlaybackException} is thrown).
|
||||
* @param joining Whether this renderer is being enabled to join an ongoing playback.
|
||||
* @throws ExoPlaybackException If an error occurs.
|
||||
*/
|
||||
protected void onEnabled(int track, long positionUs, boolean joining)
|
||||
|
|
|
|||
Loading…
Reference in a new issue