mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
dont pause playback unfocused if no video present
This commit is contained in:
parent
cb4ec71dc1
commit
1d93eb772e
2 changed files with 11 additions and 5 deletions
|
@ -1,12 +1,11 @@
|
|||
{
|
||||
"image": "mcr.microsoft.com/devcontainers/universal:2",
|
||||
"postCreateCommand": "sudo chown $(whoami) /opt/android/",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/java:1": {
|
||||
"ghcr.io/devcontainers/features/java:latest": {
|
||||
"version": "17"
|
||||
},
|
||||
"ghcr.io/akhildevelops/devcontainer-features/android-cli:latest": {
|
||||
"PACKAGES": "platform-tools,platforms;android-29"
|
||||
}
|
||||
"ghcr.io/akhildevelops/devcontainer-features/android-cli:0": {}
|
||||
},
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
|
|
|
@ -90,6 +90,7 @@ class CS3IPlayer : IPlayer {
|
|||
private var currentLink: ExtractorLink? = null
|
||||
private var currentDownloadedFile: ExtractorUri? = null
|
||||
private var hasUsedFirstRender = false
|
||||
private var shouldPauseUnfocused = true
|
||||
|
||||
private var currentWindow: Int = 0
|
||||
private var playbackPosition: Long = 0
|
||||
|
@ -509,6 +510,7 @@ class CS3IPlayer : IPlayer {
|
|||
override fun onPause() {
|
||||
Log.i(TAG, "onPause")
|
||||
saveData()
|
||||
if (shouldPauseUnfocused)
|
||||
exoPlayer?.pause()
|
||||
//releasePlayer()
|
||||
}
|
||||
|
@ -964,6 +966,11 @@ class CS3IPlayer : IPlayer {
|
|||
embeddedSubtitlesFetched?.invoke(exoPlayerReportedTracks)
|
||||
onTracksInfoChanged?.invoke()
|
||||
subtitlesUpdates?.invoke()
|
||||
|
||||
// if there are no video tracks, but there are audio tracks, don't pause playback while in background
|
||||
val videoTrackCount = tracks.groups.filter { it.type == TRACK_TYPE_VIDEO }.length ?: 0
|
||||
val audioTrackCount = tracks.groups.filter { it.type == TRACK_TYPE_AUDIO }.length ?: 0
|
||||
shouldPauseUnfocused = videoTrackCount > 0 || audioTrackCount == 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue