mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Saving current subtitle cues on SimpleExoPlayer
This commit is contained in:
parent
9adf9542e1
commit
edd237e196
@ -92,6 +92,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
|
||||
private AudioAttributes audioAttributes;
|
||||
private float audioVolume;
|
||||
private MediaSource mediaSource;
|
||||
private List<Cue> currentCues;
|
||||
|
||||
/**
|
||||
* @param renderersFactory A factory for creating {@link Renderer}s to be used by the instance.
|
||||
@ -502,6 +503,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
|
||||
|
||||
@Override
|
||||
public void addTextOutput(TextOutput listener) {
|
||||
listener.onCues(currentCues);
|
||||
textOutputs.add(listener);
|
||||
}
|
||||
|
||||
@ -775,6 +777,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
|
||||
mediaSource = null;
|
||||
analyticsCollector.resetForNewMediaSource();
|
||||
}
|
||||
currentCues = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -790,6 +793,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
|
||||
if (mediaSource != null) {
|
||||
mediaSource.removeEventListener(analyticsCollector);
|
||||
}
|
||||
currentCues = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1095,6 +1099,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
|
||||
|
||||
@Override
|
||||
public void onCues(List<Cue> cues) {
|
||||
currentCues = cues;
|
||||
for (TextOutput textOutput : textOutputs) {
|
||||
textOutput.onCues(cues);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user