Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add property 'kind' into CaptionTrack #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/src/caption_track.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class CaptionTrack {
required this.baseUrl,
required this.name,
required this.languageCode,
required this.kind,
});

/// Base URL of the caption track. This is used to get actual subtitles.
Expand All @@ -15,20 +16,24 @@ class CaptionTrack {
/// The language code of the caption track.
final String languageCode;

/// The kind of the caption track. The kind of a caption track generated using automatic speech recognition will be 'asr'.
final String kind;

@override
bool operator ==(Object other) {
if (identical(this, other)) return true;

return other is CaptionTrack &&
other.baseUrl == baseUrl &&
other.name == name &&
other.languageCode == languageCode;
other.languageCode == languageCode &&
other.kind == kind;
}

@override
int get hashCode => baseUrl.hashCode ^ name.hashCode ^ languageCode.hashCode;
int get hashCode => baseUrl.hashCode ^ name.hashCode ^ languageCode.hashCode ^ kind.hashCode;

@override
String toString() =>
'CaptionTrack(baseUrl: $baseUrl, name: $name, languageCode: $languageCode)';
'CaptionTrack(baseUrl: $baseUrl, name: $name, languageCode: $languageCode, kind: $kind)';
}
4 changes: 4 additions & 0 deletions lib/src/dtos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@ class CaptionTrackDto {
required this.baseUrl,
required this.name,
required this.languageCode,
required this.kind,
});

factory CaptionTrackDto.fromJson(Map<String, dynamic> json) {
return CaptionTrackDto(
baseUrl: json['baseUrl'],
name: json['name'] == null ? '' : json['name']['simpleText'],
languageCode: json['languageCode'],
kind: json['kind'] == null ? '' : json['kind'],
DdavidC marked this conversation as resolved.
Show resolved Hide resolved
);
}

final String baseUrl;
final String name;
final String languageCode;
final String kind;

CaptionTrack toEntity() => CaptionTrack(
baseUrl: baseUrl,
name: name,
languageCode: languageCode,
kind: kind,
);
}