Save/restore current cues in SimpleExoPlayer

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197531839
This commit is contained in:
andrewlewis 2018-05-22 02:16:10 -07:00 committed by Andrew Lewis
parent 5140341094
commit 1896f2fa7c

View File

@ -92,7 +92,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
private AudioAttributes audioAttributes;
private float audioVolume;
private MediaSource mediaSource;
private @Nullable List<Cue> currentCues;
private List<Cue> currentCues;
/**
* @param renderersFactory A factory for creating {@link Renderer}s to be used by the instance.
@ -178,6 +178,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
audioSessionId = C.AUDIO_SESSION_ID_UNSET;
audioAttributes = AudioAttributes.DEFAULT;
videoScalingMode = C.VIDEO_SCALING_MODE_DEFAULT;
currentCues = Collections.emptyList();
// Build the player and associated objects.
player = createExoPlayerImpl(renderers, trackSelector, loadControl, clock);
@ -503,7 +504,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
@Override
public void addTextOutput(TextOutput listener) {
if(currentCues != null) {
if (!currentCues.isEmpty()) {
listener.onCues(currentCues);
}
textOutputs.add(listener);
@ -779,7 +780,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
mediaSource = null;
analyticsCollector.resetForNewMediaSource();
}
currentCues = null;
currentCues = Collections.emptyList();
}
@Override
@ -795,7 +796,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
if (mediaSource != null) {
mediaSource.removeEventListener(analyticsCollector);
}
currentCues = null;
currentCues = Collections.emptyList();
}
@Override