VideoController class
VideoController
VideoController is used to initialize & display video output.
It takes reference to existing Player instance from package:media_kit
.
Passing VideoController to Video widget will cause the video output to be displayed.
late final player = Player();
late final controller = VideoController(player);
Configurable options:
- You can limit size of the video output by specifying VideoControllerConfiguration.width & VideoControllerConfiguration.height.
- A smaller width & height may yield substantial performance improvements.
- By default, both VideoControllerConfiguration.height & VideoControllerConfiguration.width are
null
i.e. output is based on video's resolution.
- You can reduce scale of the video output by specifying VideoControllerConfiguration.scale.
- A smaller scale may yield substantial performance improvements. Specifying this value will cause VideoControllerConfiguration.width & VideoControllerConfiguration.height to be ignored.
- By default, VideoControllerConfiguration.scale is
1.0
i.e. output is based on video's resolution.
- You can switch between GPU & CPU rendering by specifying VideoControllerConfiguration.enableHardwareAcceleration.
- Disabling the option may improve stability on certain devices.
- By default, VideoControllerConfiguration.enableHardwareAcceleration is
true
i.e. GPU (Direct3D/OpenGL/METAL) is utilized.
Platform specific limitations & differences:
Android
- VideoControllerConfiguration.width & VideoControllerConfiguration.height arguments have no effect.
Web
- VideoControllerConfiguration.width & VideoControllerConfiguration.height arguments have no effect.
- Only single Video output can be displayed for a VideoController. Displaying multiple Video widgets with same VideoController will cause only last mounted Video to be displayed.
- VideoControllerConfiguration.enableHardwareAcceleration is ignored i.e. GPU usage is dependent upon the web browser.
Constructors
- VideoController(Player player, {VideoControllerConfiguration configuration = const VideoControllerConfiguration()})
- VideoController
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
→ ValueNotifier<
int?> -
Texture ID of the video output, registered with Flutter engine by the native implementation.
final
-
notifier
→ ValueNotifier<
PlatformVideoController?> -
Platform specific internal implementation initialized depending upon the current platform.
final
-
platform
→ Completer<
PlatformVideoController> -
Platform specific internal implementation initialized depending upon the current platform.
final
- player → Player
-
The Player instance associated with this VideoController.
final
-
rect
→ ValueNotifier<
Rect?> -
Rect of the video output, received from the native implementation.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
waitUntilFirstFrameRendered
→ Future<
void> -
A Future that completes when the first video frame has been rendered.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setSize(
{int? width, int? height}) → Future< void> -
Sets the required size of the video output.
This may yield substantial performance improvements if a small
width
&height
is specified. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited