From 74b25e5a5426c86b1883ba072ed12c9a4a07dbaf Mon Sep 17 00:00:00 2001 From: chrisk325 Date: Tue, 14 Apr 2026 00:05:59 +0530 Subject: [PATCH 1/5] fix: libass positioning --- .../features/player/PlayerEngine.android.kt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/composeApp/src/androidMain/kotlin/com/nuvio/app/features/player/PlayerEngine.android.kt b/composeApp/src/androidMain/kotlin/com/nuvio/app/features/player/PlayerEngine.android.kt index cf975fa9..63c2a777 100644 --- a/composeApp/src/androidMain/kotlin/com/nuvio/app/features/player/PlayerEngine.android.kt +++ b/composeApp/src/androidMain/kotlin/com/nuvio/app/features/player/PlayerEngine.android.kt @@ -46,7 +46,6 @@ import androidx.media3.ui.PlayerView import androidx.media3.ui.SubtitleView import androidx.media3.ui.CaptionStyleCompat import com.nuvio.app.R -import io.github.peerless2012.ass.media.kt.withAssSupport import io.github.peerless2012.ass.media.widget.AssSubtitleView import kotlinx.coroutines.delay import kotlinx.coroutines.Dispatchers @@ -480,14 +479,14 @@ private fun PlayerView.syncLibassOverlay( enabled: Boolean, renderType: LibassRenderType, ) { - val subtitleView = subtitleView ?: return + val overlayContainer = findViewById(R.id.libass_overlay_container) ?: return val needsOverlay = enabled && renderType.usesOverlaySubtitleView() val boundPlayer = getTag(R.id.libass_overlay_bound_player) as? ExoPlayer - val hasOverlayChild = subtitleView.hasAssOverlayChild() + val hasOverlayChild = overlayContainer.hasAssOverlayChild() if (!needsOverlay) { if (hasOverlayChild) { - subtitleView.removeAssOverlayChildren() + overlayContainer.removeAssOverlayChildren() } if (boundPlayer != null) { setTag(R.id.libass_overlay_bound_player, null) @@ -500,15 +499,19 @@ private fun PlayerView.syncLibassOverlay( return } - subtitleView.removeAssOverlayChildren() - subtitleView.withAssSupport(assHandler) + overlayContainer.removeAssOverlayChildren() + val assSubtitleView = AssSubtitleView(overlayContainer.context, assHandler) + overlayContainer.addView( + assSubtitleView, + android.widget.FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) + ) setTag(R.id.libass_overlay_bound_player, player) } private fun LibassRenderType.usesOverlaySubtitleView(): Boolean = this == LibassRenderType.OVERLAY_CANVAS || this == LibassRenderType.OVERLAY_OPEN_GL -private fun SubtitleView.hasAssOverlayChild(): Boolean { +private fun android.widget.FrameLayout.hasAssOverlayChild(): Boolean { for (index in 0 until childCount) { if (getChildAt(index) is AssSubtitleView) { return true @@ -517,7 +520,7 @@ private fun SubtitleView.hasAssOverlayChild(): Boolean { return false } -private fun SubtitleView.removeAssOverlayChildren() { +private fun android.widget.FrameLayout.removeAssOverlayChildren() { for (index in childCount - 1 downTo 0) { if (getChildAt(index) is AssSubtitleView) { removeViewAt(index) From 6e903d4b6efd4f21744b5a7e115dfbdfe7d34636 Mon Sep 17 00:00:00 2001 From: chrisk325 Date: Tue, 14 Apr 2026 00:08:13 +0530 Subject: [PATCH 2/5] fix: libass positioning --- composeApp/src/androidMain/res/layout/exo_player_view.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/composeApp/src/androidMain/res/layout/exo_player_view.xml b/composeApp/src/androidMain/res/layout/exo_player_view.xml index b066524c..12e38f2b 100644 --- a/composeApp/src/androidMain/res/layout/exo_player_view.xml +++ b/composeApp/src/androidMain/res/layout/exo_player_view.xml @@ -19,10 +19,13 @@ android:layout_height="match_parent" android:scaleType="fitXY" /> + + - Date: Tue, 14 Apr 2026 00:37:30 +0530 Subject: [PATCH 3/5] fix: libass positioning --- .../com/nuvio/app/features/player/PlayerEngine.android.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/composeApp/src/androidMain/kotlin/com/nuvio/app/features/player/PlayerEngine.android.kt b/composeApp/src/androidMain/kotlin/com/nuvio/app/features/player/PlayerEngine.android.kt index 63c2a777..bcf964c8 100644 --- a/composeApp/src/androidMain/kotlin/com/nuvio/app/features/player/PlayerEngine.android.kt +++ b/composeApp/src/androidMain/kotlin/com/nuvio/app/features/player/PlayerEngine.android.kt @@ -479,7 +479,12 @@ private fun PlayerView.syncLibassOverlay( enabled: Boolean, renderType: LibassRenderType, ) { - val overlayContainer = findViewById(R.id.libass_overlay_container) ?: return + val containerId = if (renderType == LibassRenderType.OVERLAY_OPEN_GL) { + R.id.libass_overlay_container_gl + } else { + R.id.libass_overlay_container + } + val overlayContainer = findViewById(containerId) ?: return val needsOverlay = enabled && renderType.usesOverlaySubtitleView() val boundPlayer = getTag(R.id.libass_overlay_bound_player) as? ExoPlayer val hasOverlayChild = overlayContainer.hasAssOverlayChild() From db958cdda0650c07c490382998d943daddb5963c Mon Sep 17 00:00:00 2001 From: chrisk325 Date: Tue, 14 Apr 2026 00:38:45 +0530 Subject: [PATCH 4/5] fix: libass positioning --- composeApp/src/androidMain/res/layout/exo_player_view.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composeApp/src/androidMain/res/layout/exo_player_view.xml b/composeApp/src/androidMain/res/layout/exo_player_view.xml index 12e38f2b..e6a1d7a4 100644 --- a/composeApp/src/androidMain/res/layout/exo_player_view.xml +++ b/composeApp/src/androidMain/res/layout/exo_player_view.xml @@ -26,6 +26,11 @@ + + Date: Tue, 14 Apr 2026 00:40:46 +0530 Subject: [PATCH 5/5] Update ids.xml --- composeApp/src/androidMain/res/values/ids.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composeApp/src/androidMain/res/values/ids.xml b/composeApp/src/androidMain/res/values/ids.xml index c5bc55da..c238c0e7 100644 --- a/composeApp/src/androidMain/res/values/ids.xml +++ b/composeApp/src/androidMain/res/values/ids.xml @@ -1,4 +1,5 @@ - \ No newline at end of file + +