Media3/exoplayer introduced a regression where the device can sleep while video/audio are playing. Patch restores v23 behavior
This commit is contained in:
parent
75c42cb5c1
commit
90f35ed009
1 changed files with 5 additions and 0 deletions
|
|
@ -35,6 +35,7 @@ import android.util.Log
|
|||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.webkit.MimeTypeMap
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.ShareCompat
|
||||
|
|
@ -155,6 +156,10 @@ class ViewMediaActivity : BaseActivity(), HasAndroidInjector, ViewImageFragment.
|
|||
window.sharedElementEnterTransition.removeListener(this)
|
||||
}
|
||||
})
|
||||
|
||||
// Prevent this activity from dimming or sleeping the screen if it is playing video or audio
|
||||
if (attachments!![binding.viewPager.currentItem].attachment.type != Attachment.Type.IMAGE)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue