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 ...@@ -92,7 +92,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
private AudioAttributes audioAttributes; private AudioAttributes audioAttributes;
private float audioVolume; private float audioVolume;
private MediaSource mediaSource; 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. * @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 ...@@ -178,6 +178,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
audioSessionId = C.AUDIO_SESSION_ID_UNSET; audioSessionId = C.AUDIO_SESSION_ID_UNSET;
audioAttributes = AudioAttributes.DEFAULT; audioAttributes = AudioAttributes.DEFAULT;
videoScalingMode = C.VIDEO_SCALING_MODE_DEFAULT; videoScalingMode = C.VIDEO_SCALING_MODE_DEFAULT;
currentCues = Collections.emptyList();
// Build the player and associated objects. // Build the player and associated objects.
player = createExoPlayerImpl(renderers, trackSelector, loadControl, clock); player = createExoPlayerImpl(renderers, trackSelector, loadControl, clock);
...@@ -503,7 +504,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player ...@@ -503,7 +504,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
@Override @Override
public void addTextOutput(TextOutput listener) { public void addTextOutput(TextOutput listener) {
if(currentCues != null) { if (!currentCues.isEmpty()) {
listener.onCues(currentCues); listener.onCues(currentCues);
} }
textOutputs.add(listener); textOutputs.add(listener);
...@@ -779,7 +780,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player ...@@ -779,7 +780,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
mediaSource = null; mediaSource = null;
analyticsCollector.resetForNewMediaSource(); analyticsCollector.resetForNewMediaSource();
} }
currentCues = null; currentCues = Collections.emptyList();
} }
@Override @Override
...@@ -795,7 +796,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player ...@@ -795,7 +796,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
if (mediaSource != null) { if (mediaSource != null) {
mediaSource.removeEventListener(analyticsCollector); mediaSource.removeEventListener(analyticsCollector);
} }
currentCues = null; currentCues = Collections.emptyList();
} }
@Override @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