Skip to content

Commit

Permalink
Fix use of the wrong codec in the list of available streams for exter…
Browse files Browse the repository at this point in the history
…nal players after a codec change in Video and Audio settings

The VideoDetailFragment will now get video streams dynamically instead of storing them as a field, so the good codec can be chosen by ListHelper.
  • Loading branch information
AudricV committed Apr 11, 2022
1 parent 46aa5b7 commit a75029c
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public final class VideoDetailFragment
@Nullable
private Disposable positionSubscriber = null;

private List<VideoStream> videoStreamsForExternalPlayers;
private BottomSheetBehavior<FrameLayout> bottomSheetBehavior;
private BroadcastReceiver broadcastReceiver;

Expand Down Expand Up @@ -1616,13 +1615,6 @@ public void handleResult(@NonNull final StreamInfo info) {
binding.detailToggleSecondaryControlsView.setVisibility(View.VISIBLE);
binding.detailSecondaryControlPanel.setVisibility(View.GONE);

final List<VideoStream> videoStreams = removeNonUrlAndTorrentStreams(
new ArrayList<>(currentInfo.getVideoStreams()));
final List<VideoStream> videoOnlyStreams = removeNonUrlAndTorrentStreams(
new ArrayList<>(currentInfo.getVideoOnlyStreams()));
videoStreamsForExternalPlayers = ListHelper.getSortedStreamVideosList(activity,
videoStreams, videoOnlyStreams, false, false);

updateProgressInfo(info);
initThumbnailViews(info);
showMetaInfoInTextView(info.getMetaInfo(), binding.detailMetaInfoTextView,
Expand Down Expand Up @@ -2157,11 +2149,19 @@ private void showExternalPlaybackDialog() {
return;
}

final List<VideoStream> videoStreams = removeNonUrlAndTorrentStreams(
new ArrayList<>(currentInfo.getVideoStreams()));
final List<VideoStream> videoOnlyStreams = removeNonUrlAndTorrentStreams(
new ArrayList<>(currentInfo.getVideoOnlyStreams()));

final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.select_quality_external_players);
builder.setNegativeButton(android.R.string.cancel, null);
builder.setNeutralButton(R.string.open_in_browser, (dialog, i) ->
ShareUtils.openUrlInBrowser(requireActivity(), url));
final List<VideoStream> videoStreamsForExternalPlayers =
ListHelper.getSortedStreamVideosList(activity, videoStreams, videoOnlyStreams,
false, false);
if (videoStreamsForExternalPlayers.isEmpty()) {
builder.setMessage(R.string.no_video_streams_available_for_external_players);
} else {
Expand Down

0 comments on commit a75029c

Please sign in to comment.