FFplayAndroidSurface class
Flutter Texture-backed Android surface for FFplay video output.
Creates native android.view.Surface registered with Flutter's
TextureRegistry, obtains ANativeWindow* pointer, and exposes both
as a Widget (via toWidget) and SDL blit target (via bindToFFplay).
Typical usage
// Before starting playback:
_surface = await FFplayAndroidSurface.create();
if (_surface != null) _surface!.bindToFFplay();
final session = await FFplayKit.executeAsync('-i "$path"');
// Display in the widget tree:
_surface?.toWidget() // use inside AspectRatio / SizedBox
// When done:
await _surface?.release();
_surface = null;
On non-Android platforms create returns null and all other methods
are no-ops.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- nativeWindowPtr → int
-
Native ANativeWindow* as a Dart int.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textureId → int
-
Flutter texture ID — pass to Texture(textureId: textureId).
final
Methods
-
bindToFFplay(
) → void -
Registers surface as FFplay video output target.
Must be called before
FFplayKit.executeAsync. No-op on non-Android platforms. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
release(
) → Future< void> - Clears FFplay video output binding and releases native resources. After calling this, discard the FFplayAndroidSurface instance.
-
toString(
) → String -
A string representation of this object.
inherited
-
toWidget(
) → Widget - Returns Widget that displays this surface in Flutter widget tree. Uses ValueKey to force widget recreation when textureId changes.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
create(
{int width = 1, int height = 1}) → Future< FFplayAndroidSurface?> -
Allocates new Flutter texture + native
Surface.widthandheightare optional hints for initialSurfaceTexture.setDefaultBufferSize. Native blit code callsANativeWindow_setBuffersGeometryeach frame, so actual video dimensions take effect automatically. Returnsnullon non-Android platforms or if surface creation fails.