Skip to content

Commit

Permalink
fix: handling when onStop is called while in multi-window mode
Browse files Browse the repository at this point in the history
  • Loading branch information
YangJonghun committed Jan 23, 2024
1 parent 05e704d commit d742b96
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.brentvatne.exoplayer

import android.os.Build
import androidx.fragment.app.Fragment

class ReactExoplayerFragment(private val view: ReactExoplayerView) : Fragment() {
Expand All @@ -17,6 +18,11 @@ class ReactExoplayerFragment(private val view: ReactExoplayerView) : Fragment()
super.onStop()
if (!view.playInBackground) view.setPausedModifier(true)
mIsOnStopCalled = true

// Handling when onStop is called while in multi-window mode
if (Build.VERSION.SDK_INT >= 24 && activity?.isInMultiWindowMode == true && activity?.isInPictureInPictureMode != true && !view.playInBackground) {
view.setPausedModifier(true)
}
}

override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean) {
Expand Down

0 comments on commit d742b96

Please sign in to comment.