diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/PlayerActivity.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/PlayerActivity.kt index c6f0665d7e..c18bfc7506 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/PlayerActivity.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/PlayerActivity.kt @@ -127,21 +127,7 @@ class PlayerActivity : BasePlayerActivity() { speedButton.isEnabled = true speedButton.imageAlpha = 255 - if (appPreferences.showChapterMarkers) { - val playerControlView = findViewById(R.id.exo_controller) - val chapters: LongArray = when (viewModel.player) { - is MPVPlayer -> { - val player = (viewModel.player as MPVPlayer) - LongArray(player.getNumberOfChapters()) { index -> player.getChapterTime(index).toLong() * 1000 } - } - else -> LongArray(0) - } - - playerControlView.setExtraAdGroupMarkers( - chapters, - BooleanArray(chapters.size) { false }, - ) - } + loadChapters() } } } @@ -277,4 +263,22 @@ class PlayerActivity : BasePlayerActivity() { viewModel.initializePlayer(args.items) hideSystemUI() } + + private fun loadChapters() { + if (appPreferences.showChapterMarkers) { + val playerControlView = findViewById(R.id.exo_controller) + val chapters: LongArray = when (viewModel.player) { + is MPVPlayer -> { + val player = (viewModel.player as MPVPlayer) + LongArray(player.getNumberOfChapters()) { index -> player.getChapterTime(index).toLong() * 1000 } + } + else -> LongArray(0) + } + + playerControlView.setExtraAdGroupMarkers( + chapters, + BooleanArray(chapters.size) { false }, + ) + } + } }