Commit 1896f2fa by andrewlewis Committed by Andrew Lewis

Save/restore current cues in SimpleExoPlayer

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197531839
parent 51403410
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment