Compare commits

...

3 commits

Author SHA1 Message Date
Cloudburst
66edec8a45 oops size not length 2023-08-28 19:29:38 +00:00
Cloudburst
1d93eb772e dont pause playback unfocused if no video present 2023-08-28 19:15:24 +00:00
Cloudburst
cb4ec71dc1
[skip ci] Create .devcontainer.json 2023-08-28 20:08:16 +02:00
2 changed files with 25 additions and 1 deletions

17
.devcontainer.json Normal file
View file

@ -0,0 +1,17 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"postCreateCommand": "sudo chown $(whoami) /opt/android/",
"features": {
"ghcr.io/devcontainers/features/java:latest": {
"version": "17"
},
"ghcr.io/akhildevelops/devcontainer-features/android-cli:0": {}
},
"customizations": {
"vscode": {
"extensions": [
"fwcd.kotlin"
]
}
}
}

View file

@ -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,7 +510,8 @@ class CS3IPlayer : IPlayer {
override fun onPause() {
Log.i(TAG, "onPause")
saveData()
exoPlayer?.pause()
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 }.size
val audioTrackCount = tracks.groups.filter { it.type == TRACK_TYPE_AUDIO }.size
shouldPauseUnfocused = videoTrackCount > 0 || audioTrackCount == 0
}
}