From 714591dd2e5866908baa9c6c10726a75fa881c8f Mon Sep 17 00:00:00 2001 From: rebelonion <87634197+rebelonion@users.noreply.github.com> Date: Mon, 15 Apr 2024 01:51:33 -0500 Subject: [PATCH] fix: infinite loop --- .../ani/dantotsu/media/anime/ExoplayerView.kt | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt index f0b31aca21..a350f4655d 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt @@ -1518,7 +1518,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL } } - //Source exoSource.setOnClickListener { sourceClick() @@ -1572,6 +1571,12 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL }.show() dialog.window?.setDimAmount(0.8f) } else buildExoplayer() + + val isDisabled = (subtitle == null && hasExtSubtitles) + exoPlayer.trackSelectionParameters = exoPlayer.trackSelectionParameters + .buildUpon() + .setTrackTypeDisabled(TRACK_TYPE_TEXT, isDisabled) + .build() } private fun buildExoplayer() { @@ -1912,17 +1917,9 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL } TRACK_TYPE_TEXT -> { if (!hasExtSubtitles) { - if ( - it.isSupported(true) && - it.mediaTrackGroup.id != "Dummy Track" - ) subTracks.add(it) + if (it.isSupported(true)) subTracks.add(it) return@forEach } - if (it.mediaTrackGroup.id == "1:") { - onSetTrackGroupOverride(it, TRACK_TYPE_TEXT, it.length - 1) - } else { - onSetTrackGroupOverride(dummyTrack, TRACK_TYPE_TEXT) - } } } }