-Fixed video players end screen not cleared on restarting playback after single stream play queue is completed.

This commit is contained in:
John Zhen Mo 2018-06-05 23:48:44 -07:00
parent 8efcc8f80f
commit 06374c82fd
1 changed files with 20 additions and 9 deletions

View File

@ -315,14 +315,13 @@ public abstract class VideoPlayer extends BasePlayer
} }
captionPopupMenu.setOnDismissListener(this); captionPopupMenu.setOnDismissListener(this);
} }
/*//////////////////////////////////////////////////////////////////////////
// Playback Listener
//////////////////////////////////////////////////////////////////////////*/
protected abstract VideoPlaybackResolver.QualityResolver getQualityResolver();
protected void onMetadataChanged(@NonNull final MediaSourceTag tag) { private void updateStreamRelatedViews() {
super.onMetadataChanged(tag); if (getCurrentMetadata() == null) return;
final MediaSourceTag tag = getCurrentMetadata();
final StreamInfo metadata = tag.getMetadata();
qualityTextView.setVisibility(View.GONE); qualityTextView.setVisibility(View.GONE);
playbackSpeedTextView.setVisibility(View.GONE); playbackSpeedTextView.setVisibility(View.GONE);
@ -330,7 +329,7 @@ public abstract class VideoPlayer extends BasePlayer
playbackEndTime.setVisibility(View.GONE); playbackEndTime.setVisibility(View.GONE);
playbackLiveSync.setVisibility(View.GONE); playbackLiveSync.setVisibility(View.GONE);
switch (tag.getMetadata().getStreamType()) { switch (metadata.getStreamType()) {
case AUDIO_STREAM: case AUDIO_STREAM:
surfaceView.setVisibility(View.GONE); surfaceView.setVisibility(View.GONE);
endScreen.setVisibility(View.VISIBLE); endScreen.setVisibility(View.VISIBLE);
@ -350,8 +349,8 @@ public abstract class VideoPlayer extends BasePlayer
break; break;
case VIDEO_STREAM: case VIDEO_STREAM:
final StreamInfo info = tag.getMetadata(); if (metadata.getVideoStreams().size() + metadata.getVideoOnlyStreams().size() == 0)
if (info.getVideoStreams().size() + info.getVideoOnlyStreams().size() == 0) break; break;
availableStreams = tag.getSortedAvailableVideoStreams(); availableStreams = tag.getSortedAvailableVideoStreams();
selectedStreamIndex = tag.getSelectedVideoStreamIndex(); selectedStreamIndex = tag.getSelectedVideoStreamIndex();
@ -368,6 +367,16 @@ public abstract class VideoPlayer extends BasePlayer
buildPlaybackSpeedMenu(); buildPlaybackSpeedMenu();
playbackSpeedTextView.setVisibility(View.VISIBLE); playbackSpeedTextView.setVisibility(View.VISIBLE);
} }
/*//////////////////////////////////////////////////////////////////////////
// Playback Listener
//////////////////////////////////////////////////////////////////////////*/
protected abstract VideoPlaybackResolver.QualityResolver getQualityResolver();
protected void onMetadataChanged(@NonNull final MediaSourceTag tag) {
super.onMetadataChanged(tag);
updateStreamRelatedViews();
}
@Override @Override
@Nullable @Nullable
@ -400,6 +409,8 @@ public abstract class VideoPlayer extends BasePlayer
public void onPlaying() { public void onPlaying() {
super.onPlaying(); super.onPlaying();
updateStreamRelatedViews();
showAndAnimateControl(-1, true); showAndAnimateControl(-1, true);
playbackSeekBar.setEnabled(true); playbackSeekBar.setEnabled(true);