TTVideoEngineVideoModelSource.fromJson constructor
TTVideoEngineVideoModelSource.fromJson(
- Map<String, dynamic> json
)
Implementation
factory TTVideoEngineVideoModelSource.fromJson(Map<String, dynamic> json) =>
TTVideoEngineVideoModelSource(
vid: json["vid"],
duration: json["duration"]?.toDouble(),
resolution: () {
final dynamic raw = json["resolution"];
final int? idx =
raw is int ? raw : int.tryParse(raw?.toString() ?? '');
if (idx == null ||
idx < 0 ||
idx >= TTVideoEngineResolutionType.values.length) {
return TTVideoEngineResolutionType
.TTVideoEngineResolutionTypeUnknown;
}
return TTVideoEngineResolutionType.values[idx];
}(),
playInfoList: (json["playInfoList"] == null ||
json["playInfoList"] is! List)
? []
: List<PlayInfoListItem>.from(
json["playInfoList"]!.map((x) => PlayInfoListItem.fromJson(x))),
jsonModel: json["jsonModel"],
);