fix(android): track VideoOverlayManager.kt in canonical source tree
Some checks failed
🏗️ Build and Test JellyTau / Run Tests (push) Successful in 2m28s
Traceability Validation / Check Requirement Traces (push) Successful in 20s
Build & Release / Run Tests (push) Successful in 3m11s
🏗️ Build and Test JellyTau / Build Android APK (push) Successful in 17m51s
Build & Release / Build Linux (push) Successful in 15m29s
Build & Release / Build Android (push) Failing after 18m9s
Build & Release / Create Release (push) Has been skipped
Some checks failed
🏗️ Build and Test JellyTau / Run Tests (push) Successful in 2m28s
Traceability Validation / Check Requirement Traces (push) Successful in 20s
Build & Release / Run Tests (push) Successful in 3m11s
🏗️ Build and Test JellyTau / Build Android APK (push) Successful in 17m51s
Build & Release / Build Linux (push) Successful in 15m29s
Build & Release / Build Android (push) Failing after 18m9s
Build & Release / Create Release (push) Has been skipped
JellyTauPlayer.kt references com.dtourolle.jellytau.VideoOverlayManager, but the file existed only in the gitignored gen/android dir, so it survived locally but vanished in CI (which regenerates gen/android via 'tauri android init'). sync-android-sources.sh copies top-level *.kt from src-tauri/android, so adding it there gets it synced into the build. Fixes: 'Unresolved reference: VideoOverlayManager' in :app:compileUniversalReleaseKotlin. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
7fb866a583
commit
3faa595b76
@ -0,0 +1,86 @@
|
|||||||
|
package com.dtourolle.jellytau
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.view.SurfaceView
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import com.dtourolle.jellytau.player.JellyTauPlayer
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages the video SurfaceView overlay in the Activity's view hierarchy.
|
||||||
|
*
|
||||||
|
* This class handles attaching and detaching the native ExoPlayer SurfaceView
|
||||||
|
* so that it renders video content behind the WebView.
|
||||||
|
*/
|
||||||
|
object VideoOverlayManager {
|
||||||
|
|
||||||
|
private var attachedSurfaceView: SurfaceView? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attach the video SurfaceView to the Activity's content view.
|
||||||
|
*
|
||||||
|
* The SurfaceView is added at index 0 (bottom of z-order) so it renders
|
||||||
|
* behind the Tauri WebView, allowing Svelte controls to overlay on top.
|
||||||
|
*
|
||||||
|
* @param activity The Activity to attach the surface to
|
||||||
|
*/
|
||||||
|
fun attachVideoSurface(activity: Activity) {
|
||||||
|
try {
|
||||||
|
// Get the SurfaceView from JellyTauPlayer
|
||||||
|
val player = JellyTauPlayer.getInstance()
|
||||||
|
val surfaceView = player.getSurfaceView()
|
||||||
|
|
||||||
|
if (surfaceView == null) {
|
||||||
|
android.util.Log.w("VideoOverlayManager", "No SurfaceView available to attach")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the root content view
|
||||||
|
val contentView = activity.window.decorView.findViewById<ViewGroup>(android.R.id.content)
|
||||||
|
|
||||||
|
// Remove from parent if already attached elsewhere
|
||||||
|
(surfaceView.parent as? ViewGroup)?.removeView(surfaceView)
|
||||||
|
|
||||||
|
// Configure layout params to fill the screen
|
||||||
|
val layoutParams = FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
|
||||||
|
// Add to content view at index 0 (behind WebView)
|
||||||
|
contentView.addView(surfaceView, 0, layoutParams)
|
||||||
|
attachedSurfaceView = surfaceView
|
||||||
|
|
||||||
|
android.util.Log.d("VideoOverlayManager", "Video surface attached to view hierarchy")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
android.util.Log.e("VideoOverlayManager", "Failed to attach video surface", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detach the video SurfaceView from the Activity's view hierarchy.
|
||||||
|
*
|
||||||
|
* @param activity The Activity to detach the surface from
|
||||||
|
*/
|
||||||
|
fun detachVideoSurface(activity: Activity) {
|
||||||
|
try {
|
||||||
|
attachedSurfaceView?.let { surfaceView ->
|
||||||
|
val contentView = activity.window.decorView.findViewById<ViewGroup>(android.R.id.content)
|
||||||
|
contentView.removeView(surfaceView)
|
||||||
|
attachedSurfaceView = null
|
||||||
|
android.util.Log.d("VideoOverlayManager", "Video surface detached from view hierarchy")
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
android.util.Log.e("VideoOverlayManager", "Failed to detach video surface", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a video surface is currently attached.
|
||||||
|
*
|
||||||
|
* @return true if a surface is attached, false otherwise
|
||||||
|
*/
|
||||||
|
fun isVideoSurfaceAttached(): Boolean {
|
||||||
|
return attachedSurfaceView != null
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user