copyWith method
VideoSourceConfiguration
copyWith({
- bool? autoPlay,
- Duration? initialPosition,
- double? initialVolume,
- double? initialPlaybackSpeed,
- List<
double> ? availablePlaybackSpeed, - bool? autoMuteOnStart,
- bool? allowSeeking,
- bool? synchronizeMuteAcrossPlayers,
- Duration? timeoutDuration,
- List<
OmniVideoQuality> ? preferredQualities, - List<
OmniVideoQuality> ? availableQualities, - bool? enableYoutubeWebViewFallback,
- bool? forceYoutubeWebViewOnly,
Returns a new instance of VideoSourceConfiguration with updated common playback fields.
The parameters that distinguish the video source (videoUrl, videoId, videoDataSource, videoSourceType) cannot be modified here to maintain consistency.
Implementation
VideoSourceConfiguration copyWith({
bool? autoPlay,
Duration? initialPosition,
double? initialVolume,
double? initialPlaybackSpeed,
List<double>? availablePlaybackSpeed,
bool? autoMuteOnStart,
bool? allowSeeking,
bool? synchronizeMuteAcrossPlayers,
Duration? timeoutDuration,
List<OmniVideoQuality>? preferredQualities,
List<OmniVideoQuality>? availableQualities,
bool? enableYoutubeWebViewFallback,
bool? forceYoutubeWebViewOnly,
}) {
final newPreferred = preferredQualities ?? this.preferredQualities;
final newAvailable = availableQualities ?? this.availableQualities;
_validatePreferredQualities(
preferred: newPreferred,
available: newAvailable,
);
return VideoSourceConfiguration._(
videoUrl: videoUrl,
videoId: videoId,
videoDataSource: videoDataSource,
videoSourceType: videoSourceType,
autoPlay: autoPlay ?? this.autoPlay,
initialPosition: initialPosition ?? this.initialPosition,
initialVolume: initialVolume ?? this.initialVolume,
initialPlaybackSpeed: initialPlaybackSpeed ?? this.initialPlaybackSpeed,
availablePlaybackSpeed:
availablePlaybackSpeed ?? this.availablePlaybackSpeed,
autoMuteOnStart: autoMuteOnStart ?? this.autoMuteOnStart,
preferredQualities: newPreferred,
availableQualities: newAvailable,
allowSeeking: allowSeeking ?? this.allowSeeking,
timeoutDuration: timeoutDuration ?? this.timeoutDuration,
enableYoutubeWebViewFallback:
enableYoutubeWebViewFallback ?? this.enableYoutubeWebViewFallback,
forceYoutubeWebViewOnly:
forceYoutubeWebViewOnly ?? this.forceYoutubeWebViewOnly,
synchronizeMuteAcrossPlayers:
synchronizeMuteAcrossPlayers ?? this.synchronizeMuteAcrossPlayers,
);
}