Skip to main content

Toggle Controls

Better Player allows you to programmatically manage the visibility and behavior of the player controls at runtime.

Enabling and Disabling Controls​

You can completely enable or disable all player controls using the setControlsEnabled method:

// Disables all controls (Default is true)
betterPlayerController.setControlsEnabled(false);

Persistent Controls Visibility​

By default, controls will fade out after a period of inactivity. You can force the controls to remain visible indefinitely using the setControlsAlwaysVisible method:

// Controls will remain visible on top of the video
betterPlayerController.setControlsAlwaysVisible(true);

Inspecting and Listening to Visibility​

Check whether controls are currently visible using the isControlsVisible getter:

final bool isVisible = betterPlayerController.isControlsVisible;

To react to visibility changes in real time, listen to controlsVisibilityStream:

betterPlayerController.controlsVisibilityStream.listen((bool isVisible) {
// Sync your custom overlay with the player controls
});