mirror of
https://github.com/samsonjs/media.git
synced 2026-04-20 13:45:47 +00:00
Merge pull request #4252 from pedromfmachado/save_current_subtitle_cues
Saving current subtitle cues on SimpleExoPlayer
This commit is contained in:
commit
49691e5117
1 changed files with 7 additions and 0 deletions
|
|
@ -92,6 +92,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
|
|||
private AudioAttributes audioAttributes;
|
||||
private float audioVolume;
|
||||
private MediaSource mediaSource;
|
||||
private @Nullable List<Cue> currentCues;
|
||||
|
||||
/**
|
||||
* @param renderersFactory A factory for creating {@link Renderer}s to be used by the instance.
|
||||
|
|
@ -502,6 +503,9 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
|
|||
|
||||
@Override
|
||||
public void addTextOutput(TextOutput listener) {
|
||||
if(currentCues != null) {
|
||||
listener.onCues(currentCues);
|
||||
}
|
||||
textOutputs.add(listener);
|
||||
}
|
||||
|
||||
|
|
@ -775,6 +779,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
|
|||
mediaSource = null;
|
||||
analyticsCollector.resetForNewMediaSource();
|
||||
}
|
||||
currentCues = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -790,6 +795,7 @@ public class SimpleExoPlayer implements ExoPlayer, Player.VideoComponent, Player
|
|||
if (mediaSource != null) {
|
||||
mediaSource.removeEventListener(analyticsCollector);
|
||||
}
|
||||
currentCues = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1095,6 +1101,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…
Reference in a new issue