Skip to content

Commit

Permalink
fix: infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelonion committed Apr 15, 2024
1 parent 6e399b3 commit 714591d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
}
}


//Source
exoSource.setOnClickListener {
sourceClick()
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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)
}
}
}
}
Expand Down

0 comments on commit 714591d

Please sign in to comment.