copyWith method
- VideoSourceConfiguration? videoSourceConfiguration,
- PlayerUIVisibilityOptions? playerUIVisibilityOptions,
- OmniVideoPlayerThemeData? playerTheme,
- CustomPlayerWidgets? customPlayerWidgets,
- String? liveLabel,
- bool? enableBackgroundOverlayClip,
Returns a new VideoPlayerConfiguration instance with specified fields overridden.
This allows for immutability while supporting customization. Use this method to derive a new configuration by modifying only the required parts.
Parameters:
-
videoSourceConfiguration
: Defines how the video is loaded and played. -
globalPlaybackControlSettings
: Controls global playback interactions like exclusive playback and mute sync. -
playerUIVisibilityOptions
: Flags that toggle visibility of player UI elements like seek bar, buttons, etc. -
playerTheme
: Theming configuration for colors, padding, typography, and overlays. -
customPlayerWidgets
: Provides custom widget overrides like loading indicators, error placeholders, etc. -
liveLabel
: Text displayed when the video is a live stream. -
enableBackgroundOverlayClip
: Whether to clip background overlays using a rounded rectangle.
Returns a new VideoPlayerConfiguration with the specified fields replaced.
Example usage:
final newOptions = oldOptions.copyWith(
liveLabel: "LIVE NOW",
playerUIVisibilityOptions: oldOptions.playerUIVisibilityOptions.copyWith(showMuteUnMuteButton: false),
);
Implementation
VideoPlayerConfiguration copyWith({
VideoSourceConfiguration? videoSourceConfiguration,
PlayerUIVisibilityOptions? playerUIVisibilityOptions,
OmniVideoPlayerThemeData? playerTheme,
CustomPlayerWidgets? customPlayerWidgets,
String? liveLabel,
bool? enableBackgroundOverlayClip,
}) {
return VideoPlayerConfiguration(
videoSourceConfiguration:
videoSourceConfiguration ?? this.videoSourceConfiguration,
playerUIVisibilityOptions:
playerUIVisibilityOptions ?? this.playerUIVisibilityOptions,
playerTheme: playerTheme ?? this.playerTheme,
customPlayerWidgets: customPlayerWidgets ?? this.customPlayerWidgets,
liveLabel: liveLabel ?? this.liveLabel,
enableBackgroundOverlayClip:
enableBackgroundOverlayClip ?? this.enableBackgroundOverlayClip,
);
}