@@ -124,6 +124,7 @@ class PreviewMediaFragment :
124124 private var exoPlayer: ExoPlayer ? = null
125125 private var mediaSession: MediaSession ? = null
126126 private var nextcloudClient: NextcloudClient ? = null
127+ private var isFullscreenActive = false
127128
128129 @OptIn(UnstableApi ::class )
129130 override fun onCreate (savedInstanceState : Bundle ? ) {
@@ -503,6 +504,9 @@ class PreviewMediaFragment :
503504 }
504505
505506 override fun onStop () {
507+ if (! isFullscreenActive) {
508+ releaseVideoPlayer()
509+ }
506510 releaseVideoPlayer()
507511 super .onStop()
508512 }
@@ -520,13 +524,24 @@ class PreviewMediaFragment :
520524 }
521525
522526 private fun startFullScreenVideo () {
523- activity?.let { activity ->
524- nextcloudClient?.let { client ->
525- exoPlayer?.let { player ->
526- PreviewVideoFullscreenDialog (activity, client, player, binding.exoplayerView).show()
527- }
527+ val activity = activity ? : return
528+ val client = nextcloudClient ? : return
529+ val player = exoPlayer ? : return
530+
531+ isFullscreenActive = true
532+ val dialog = PreviewVideoFullscreenDialog (
533+ activity,
534+ client,
535+ player,
536+ binding.exoplayerView
537+ ).apply {
538+ setOnDismissListener {
539+ isFullscreenActive = false
540+ setupVideoView()
528541 }
529542 }
543+
544+ dialog.show()
530545 }
531546
532547 override fun onConfigurationChanged (newConfig : Configuration ) {
0 commit comments