Fix auto play when swiping between attachments (#3077)

* Fix auto play when swiping between attachments

Fixes an issue where attachment doesn't autoplay when swiping left/right from initial attachment.

Fixes #3066

* Fix lint error for wild card imports
This commit is contained in:
Eric Frohnhoefer 2022-12-30 02:22:39 -08:00 committed by GitHub
parent 65e95a7858
commit 3170e1ce71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 11 deletions

View File

@ -66,19 +66,21 @@ class ViewVideoFragment : ViewMediaFragment() {
videoActionsListener = context as VideoActionsListener
}
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
// Start/pause/resume video playback as fragment is shown/hidden
super.setUserVisibleHint(isVisibleToUser)
if (_binding == null) {
return
}
override fun onResume() {
super.onResume()
if (isVisibleToUser) {
if (_binding != null) {
if (mediaActivity.isToolbarVisible) {
handler.postDelayed(hideToolbar, TOOLBAR_HIDE_DELAY_MS)
}
binding.videoView.start()
} else {
}
}
override fun onPause() {
super.onPause()
if (_binding != null) {
handler.removeCallbacks(hideToolbar)
binding.videoView.pause()
mediaController.hide()
@ -161,9 +163,6 @@ class ViewVideoFragment : ViewMediaFragment() {
binding.progressBar.hide()
mp.isLooping = true
if (requireArguments().getBoolean(ARG_START_POSTPONED_TRANSITION)) {
binding.videoView.start()
}
}
if (requireArguments().getBoolean(ARG_START_POSTPONED_TRANSITION)) {