mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Save/restore current cues in SimpleExoPlayer
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=197531839
This commit is contained in:
parent
5140341094
commit
1896f2fa7c
1 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||||
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
|
||||||
|
|
||||||
@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
|
||||||
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
|
||||||
if (mediaSource != null) {
|
if (mediaSource != null) {
|
||||||
mediaSource.removeEventListener(analyticsCollector);
|
mediaSource.removeEventListener(analyticsCollector);
|
||||||
}
|
}
|
||||||
currentCues = null;
|
currentCues = Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue