import 'package:equatable/equatable.dart'; import '../../extensions/helpers_extension.dart'; import 'closed_caption_format.dart'; import 'language.dart'; /// Metadata associated with a certain [ClosedCaptionTrack] class ClosedCaptionTrackInfo extends Equatable { /// Manifest URL of the associated track. final Uri url; /// Language of the associated track. final Language language; /// Whether the associated track was automatically generated. final bool isAutoGenerated; /// Track format final ClosedCaptionFormat format; /// Initializes an instance of [ClosedCaptionTrackInfo] const ClosedCaptionTrackInfo(this.url, this.language, {this.isAutoGenerated = false, this.format}) : assert(format != null); /// Returns this auto-translated to another language. /// Keeping the same format. ClosedCaptionTrackInfo autoTranslate( ClosedCaptionTrackInfo trackInfo, String lang) { return ClosedCaptionTrackInfo( trackInfo.url.replaceQueryParameters({'tlang': lang}), Language(lang, ''), isAutoGenerated: trackInfo.isAutoGenerated, format: trackInfo.format); } @override String toString() => 'CC Track ($language)'; @override List get props => [url, language, isAutoGenerated]; }