Hello,
I am experiencing a rendering issue with TALVideoPlayerSurface on an Android TV emulator.
Environment
Delphi 13.1 / FireMonkey
Android TV 34 x86 AVD
Application ABI: armeabi-v7a, running through the emulator native bridge
Android Emulator OpenGL ES Translator
Host GPU: NVIDIA GeForce RTX 5070
Video player: Alcinoe TALVideoPlayerSurface using ExoPlayer
SurfaceFlinger reports:
GLES: Google (NVIDIA Corporation),
Android Emulator OpenGL ES Translator
(NVIDIA GeForce RTX 5070),
OpenGL ES 3.1
This is not currently using SwiftShader.
Application layout
The video is displayed by a dynamically created TALVideoPlayerSurface:
VideoPlayer := TALVideoPlayerSurface.Create(OwnerComponent);
VideoPlayer.Parent := LayoutVideo;
VideoPlayer.Align := TALAlignLayout.Client;
VideoPlayer.AutoStartMode :=
TALVideoPlayerSurface.TAutoStartMode.WhenPrepared;
VideoPlayer.WrapMode := TALImageWrapMode.Cover;
VideoPlayer.SendToBack;
Song lyrics are drawn into a transparent FMX TImage.Bitmap located above the video.
Focus indication uses one FireMonkey TInnerGlowEffect. Its Parent is changed whenever focus moves to another control:
procedure TMainForm.ControlEnter(Sender: TObject);
begin
MyGlowEffect.Parent := Sender as TFMXObject;
end;
Problem
Before starting video playback:
the transparent lyrics image is displayed correctly;
TInnerGlowEffect works correctly on all controls.
Immediately after the first video frame is displayed:
the transparent lyrics TImage becomes invisible;
TInnerGlowEffect becomes unreliable;
the same effect appears on some controls but not on other controls of the same type;
normal opaque controls and playback panels remain visible;
focus navigation itself still works.
Stopping video playback does not restore the missing image or effect.
Restarting the application restores everything until video playback starts again.
The problem does not occur on real ARM Android devices, including tablets and televisions.
Alcinoe implementation
As far as I can see, Alcinoe does not use a native SurfaceView or TextureView here. It creates a SurfaceTexture backed by an external OpenGL texture:
fSurfaceTexture := TJSurfaceTexture.JavaClass.init(fDrawable.Handle);
fSurface := TJSurface.JavaClass.init(fSurfaceTexture);
fExoPlayer.setVideoSurface(fSurface);
The video frame is then rendered inside TALVideoPlayerSurface.Paint.
Therefore, this does not appear to be a native Android View z-order problem.
Questions
Could drawing the GL_TEXTURE_EXTERNAL_OES video texture leave some OpenGL state modified on the Android Emulator?
In particular:
active texture unit;
bound texture;
framebuffer;
shader program;
blending state;
stencil or scissor state;
render target used by FireMonkey effects.
TInnerGlowEffect requires an intermediate framebuffer, while the lyrics image requires texture rendering with alpha blending. Both stop working after video starts, while ordinary opaque controls remain visible.
Is there any known compatibility problem between TALVideoPlayerSurface, Android Emulator OpenGL Translator, and FireMonkey effects or transparent textures?
Does Alcinoe explicitly save and restore all relevant OpenGL state after drawing the external OES texture?
Would you recommend any specific diagnostic change inside TALVideoPlayerSurface.Paint to confirm whether this is an OpenGL state leak or an Android Emulator driver issue?
I can prepare a minimal reproducible project containing only:
one TALVideoPlayerSurface;
one transparent TImage;
one TRectangle;
one movable TInnerGlowEffect.
Thank you.
Hello,
I am experiencing a rendering issue with TALVideoPlayerSurface on an Android TV emulator.
Environment
Delphi 13.1 / FireMonkey
Android TV 34 x86 AVD
Application ABI: armeabi-v7a, running through the emulator native bridge
Android Emulator OpenGL ES Translator
Host GPU: NVIDIA GeForce RTX 5070
Video player: Alcinoe TALVideoPlayerSurface using ExoPlayer
SurfaceFlinger reports:
GLES: Google (NVIDIA Corporation),
Android Emulator OpenGL ES Translator
(NVIDIA GeForce RTX 5070),
OpenGL ES 3.1
This is not currently using SwiftShader.
Application layout
The video is displayed by a dynamically created TALVideoPlayerSurface:
VideoPlayer := TALVideoPlayerSurface.Create(OwnerComponent);
VideoPlayer.Parent := LayoutVideo;
VideoPlayer.Align := TALAlignLayout.Client;
VideoPlayer.AutoStartMode :=
TALVideoPlayerSurface.TAutoStartMode.WhenPrepared;
VideoPlayer.WrapMode := TALImageWrapMode.Cover;
VideoPlayer.SendToBack;
Song lyrics are drawn into a transparent FMX TImage.Bitmap located above the video.
Focus indication uses one FireMonkey TInnerGlowEffect. Its Parent is changed whenever focus moves to another control:
procedure TMainForm.ControlEnter(Sender: TObject);
begin
MyGlowEffect.Parent := Sender as TFMXObject;
end;
Problem
Before starting video playback:
the transparent lyrics image is displayed correctly;
TInnerGlowEffect works correctly on all controls.
Immediately after the first video frame is displayed:
the transparent lyrics TImage becomes invisible;
TInnerGlowEffect becomes unreliable;
the same effect appears on some controls but not on other controls of the same type;
normal opaque controls and playback panels remain visible;
focus navigation itself still works.
Stopping video playback does not restore the missing image or effect.
Restarting the application restores everything until video playback starts again.
The problem does not occur on real ARM Android devices, including tablets and televisions.
Alcinoe implementation
As far as I can see, Alcinoe does not use a native SurfaceView or TextureView here. It creates a SurfaceTexture backed by an external OpenGL texture:
fSurfaceTexture := TJSurfaceTexture.JavaClass.init(fDrawable.Handle);
fSurface := TJSurface.JavaClass.init(fSurfaceTexture);
fExoPlayer.setVideoSurface(fSurface);
The video frame is then rendered inside TALVideoPlayerSurface.Paint.
Therefore, this does not appear to be a native Android View z-order problem.
Questions
Could drawing the GL_TEXTURE_EXTERNAL_OES video texture leave some OpenGL state modified on the Android Emulator?
In particular:
active texture unit;
bound texture;
framebuffer;
shader program;
blending state;
stencil or scissor state;
render target used by FireMonkey effects.
TInnerGlowEffect requires an intermediate framebuffer, while the lyrics image requires texture rendering with alpha blending. Both stop working after video starts, while ordinary opaque controls remain visible.
Is there any known compatibility problem between TALVideoPlayerSurface, Android Emulator OpenGL Translator, and FireMonkey effects or transparent textures?
Does Alcinoe explicitly save and restore all relevant OpenGL state after drawing the external OES texture?
Would you recommend any specific diagnostic change inside TALVideoPlayerSurface.Paint to confirm whether this is an OpenGL state leak or an Android Emulator driver issue?
I can prepare a minimal reproducible project containing only:
one TALVideoPlayerSurface;
one transparent TImage;
one TRectangle;
one movable TInnerGlowEffect.
Thank you.