Migrate to androidx-media3 video player (#3857)
Behaviour is consistent with previous player except that: - Swapping apps while a video is playing, and then returning to Tusky, will keep the seek position in the video instead of returning to the start - The controls/media description can be shown by tapping anywhere, not just on the video itself - The media description is on-screen for the same duration as the player controls (5 seconds here, 3 seconds in the previous code) - The user has options to control the playback speed - Rotating the device does not squash/stretch the video - Show the media preview when playing audio-only files Fixes https://github.com/tuskyapp/Tusky/issues/3329, https://github.com/tuskyapp/Tusky/issues/3141, https://github.com/tuskyapp/Tusky/issues/3126, https://github.com/tuskyapp/Tusky/issues/2753, https://github.com/tuskyapp/Tusky/issues/3508, https://github.com/tuskyapp/Tusky/issues/3291 --------- Co-authored-by: mcc <andi.m.mcclure@gmail.com>
This commit is contained in:
parent
09d4f62004
commit
8529f309ff
9 changed files with 314 additions and 212 deletions
|
|
@ -1,41 +0,0 @@
|
|||
package com.keylesspalace.tusky.view
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.VideoView
|
||||
|
||||
class ExposedPlayPauseVideoView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) :
|
||||
VideoView(context, attrs, defStyleAttr) {
|
||||
|
||||
private var listener: PlayPauseListener? = null
|
||||
private var playing = false
|
||||
|
||||
fun setPlayPauseListener(listener: PlayPauseListener) {
|
||||
this.listener = listener
|
||||
}
|
||||
|
||||
override fun start() {
|
||||
super.start()
|
||||
if (!playing) {
|
||||
playing = true
|
||||
listener?.onPlay()
|
||||
}
|
||||
}
|
||||
|
||||
override fun pause() {
|
||||
super.pause()
|
||||
if (playing) {
|
||||
playing = false
|
||||
listener?.onPause()
|
||||
}
|
||||
}
|
||||
|
||||
interface PlayPauseListener {
|
||||
fun onPlay()
|
||||
fun onPause()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue