From 77148d127fe838a9346632cc37ed8b0f5d78b8a6 Mon Sep 17 00:00:00 2001 From: Barry Deen Date: Sun, 5 Apr 2026 14:38:07 -0400 Subject: [PATCH] feat: keep screen awake during fullscreen video and show media controls Prevent the device from sleeping during fullscreen video playback with FLAG_KEEP_SCREEN_ON. Add a MediaSessionService so Android shows media controls in the notification shade and lock screen when the app is backgrounded, covering both fullscreen and PiP video modes. Co-Authored-By: Claude Opus 4.6 (1M context) --- app/build.gradle.kts | 1 + app/src/main/AndroidManifest.xml | 10 +++++++ .../app/ui/component/FullScreenVideoPlayer.kt | 5 ++++ .../wisp/app/ui/component/PipController.kt | 9 ++++++ .../app/ui/component/VideoMediaSession.kt | 30 +++++++++++++++++++ .../app/ui/component/VideoPlaybackService.kt | 30 +++++++++++++++++++ gradle/libs.versions.toml | 1 + 7 files changed, 86 insertions(+) create mode 100644 app/src/main/kotlin/com/wisp/app/ui/component/VideoMediaSession.kt create mode 100644 app/src/main/kotlin/com/wisp/app/ui/component/VideoPlaybackService.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3d34a6a..57d33f7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -88,6 +88,7 @@ dependencies { implementation(libs.media3.exoplayer.hls) implementation(libs.media3.datasource.okhttp) implementation(libs.media3.ui) + implementation(libs.media3.session) implementation(libs.biometric) implementation(libs.splashscreen) implementation(libs.profileinstaller) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7e6de75..4fb774e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,6 +5,8 @@ + + @@ -41,6 +43,14 @@ + + + + +