Fix media controller UI not showing during audio playback (#3286)
* Update ViewVideoFragment.kt Testing - Open audio attachment: https://solarpunk.moe/@vv/109562659215759090 - Ensure media control UI and alt text is shown once playback starts Fixes #3261 * Fix commit issue * Fix spacing
This commit is contained in:
parent
70092c8de2
commit
9e0ff78fb4
1 changed files with 14 additions and 10 deletions
|
@ -73,8 +73,8 @@ class ViewVideoFragment : ViewMediaFragment() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
if (_binding != null) {
|
if (_binding != null) {
|
||||||
if (mediaActivity.isToolbarVisible) {
|
if (mediaActivity.isToolbarVisible && !isAudio) {
|
||||||
handler.postDelayed(hideToolbar, TOOLBAR_HIDE_DELAY_MS)
|
hideToolbarAfterDelay(TOOLBAR_HIDE_DELAY_MS)
|
||||||
}
|
}
|
||||||
binding.videoView.start()
|
binding.videoView.start()
|
||||||
}
|
}
|
||||||
|
@ -130,18 +130,17 @@ class ViewVideoFragment : ViewMediaFragment() {
|
||||||
binding.videoView.setMediaController(mediaController)
|
binding.videoView.setMediaController(mediaController)
|
||||||
binding.videoView.requestFocus()
|
binding.videoView.requestFocus()
|
||||||
binding.videoView.setPlayPauseListener(object : ExposedPlayPauseVideoView.PlayPauseListener {
|
binding.videoView.setPlayPauseListener(object : ExposedPlayPauseVideoView.PlayPauseListener {
|
||||||
override fun onPause() {
|
|
||||||
handler.removeCallbacks(hideToolbar)
|
|
||||||
}
|
|
||||||
override fun onPlay() {
|
override fun onPlay() {
|
||||||
// Audio doesn't cause the controller to show automatically,
|
if (!isAudio) {
|
||||||
// and we only want to hide the toolbar if it's a video.
|
|
||||||
if (isAudio) {
|
|
||||||
mediaController.show()
|
|
||||||
} else {
|
|
||||||
hideToolbarAfterDelay(TOOLBAR_HIDE_DELAY_MS)
|
hideToolbarAfterDelay(TOOLBAR_HIDE_DELAY_MS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
if (!isAudio) {
|
||||||
|
handler.removeCallbacks(hideToolbar)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
binding.videoView.setOnPreparedListener { mp ->
|
binding.videoView.setOnPreparedListener { mp ->
|
||||||
val containerWidth = binding.videoContainer.measuredWidth.toFloat()
|
val containerWidth = binding.videoContainer.measuredWidth.toFloat()
|
||||||
|
@ -167,6 +166,11 @@ class ViewVideoFragment : ViewMediaFragment() {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Audio doesn't cause the controller to show automatically
|
||||||
|
if (isAudio) {
|
||||||
|
mediaController.show()
|
||||||
|
}
|
||||||
|
|
||||||
binding.progressBar.hide()
|
binding.progressBar.hide()
|
||||||
mp.isLooping = true
|
mp.isLooping = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue