fix: Released and removed unused data

This commit is contained in:
firelight
2025-03-09 01:02:51 +00:00
committed by GitHub
parent f915cd0c20
commit 44fadaf9b0
4 changed files with 7 additions and 11 deletions

View File

@ -76,7 +76,7 @@ const val NEXT_WATCH_EPISODE_PERCENTAGE = 90
const val UPDATE_SYNC_PROGRESS_PERCENTAGE = 80
abstract class AbstractPlayerFragment(
val player: IPlayer = CS3IPlayer()
var player: IPlayer = CS3IPlayer()
) : Fragment() {
var resizeMode: Int = 0
var subStyle: SaveCaptionStyle? = null
@ -385,11 +385,9 @@ abstract class AbstractPlayerFragment(
}
private fun onSubStyleChanged(style: SaveCaptionStyle) {
if (player is CS3IPlayer) {
player.updateSubtitleStyle(style)
// Forcefully update the subtitle encoding in case the edge size is changed
player.seekTime(-1)
}
player.updateSubtitleStyle(style)
// Forcefully update the subtitle encoding in case the edge size is changed
player.seekTime(-1)
}
@ -544,6 +542,7 @@ abstract class AbstractPlayerFragment(
),
)
val player = player
if (player is CS3IPlayer) {
// preview bar
val progressBar: PreviewTimeBar? = playerView?.findViewById(R.id.exo_progress)

View File

@ -639,9 +639,6 @@ class CS3IPlayer : IPlayer {
}
private var simpleCache: SimpleCache? = null
var requestSubtitleUpdate: (() -> Unit)? = null
private fun createOnlineSource(headers: Map<String, String>): HttpDataSource.Factory {
val source = OkHttpDataSource.Factory(app.baseClient).setUserAgent(USER_AGENT)
return source.apply {
@ -1137,8 +1134,6 @@ class CS3IPlayer : IPlayer {
maxVideoHeight = maxVideoHeight
)
requestSubtitleUpdate = ::reloadSubs
event(PlayerAttachedEvent(exoPlayer))
exoPlayer?.prepare()

View File

@ -441,6 +441,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
exitFullscreen()
player.release()
player.releaseCallbacks()
player = CS3IPlayer()
super.onDestroy()
}

View File

@ -234,6 +234,7 @@ open class ResultFragmentPhone : FullScreenPlayer() {
updateUIEvent -= ::updateUI
binding = null
resultBinding?.resultScroll?.setOnClickListener(null)
resultBinding = null
syncBinding = null
recommendationBinding = null