import 'package:pilipala/models/video/play/quality.dart'; class PlayUrlModel { PlayUrlModel({ this.from, this.result, this.message, this.quality, this.format, this.timeLength, this.acceptFormat, this.acceptDesc, this.acceptQuality, this.videoCodecid, this.seekParam, this.seekType, this.dash, this.supportFormats, // this.highFormat, this.lastPlayTime, this.lastPlayCid, }); String? from; String? result; String? message; int? quality; String? format; int? timeLength; String? acceptFormat; List? acceptDesc; List? acceptQuality; int? videoCodecid; String? seekParam; String? seekType; Dash? dash; List? supportFormats; // String? highFormat; int? lastPlayTime; int? lastPlayCid; PlayUrlModel.fromJson(Map json) { from = json['from']; result = json['result']; message = json['message']; quality = json['quality']; format = json['format']; timeLength = json['timelength']; acceptFormat = json['accept_format']; acceptDesc = json['accept_description']; acceptQuality = json['accept_quality']; videoCodecid = json['video_codecid']; seekParam = json['seek_param']; seekType = json['seek_type']; dash = Dash.fromJson(json['dash']); supportFormats = json['support_formats'] != null ? json['support_formats'] .map((e) => FormatItem.fromJson(e)) .toList() : []; lastPlayTime = json['last_play_time']; lastPlayCid = json['last_play_cid']; } } class Dash { Dash({ this.duration, this.minBufferTime, this.video, this.audio, this.dolby, this.flac, }); int? duration; double? minBufferTime; List? video; List? audio; Map? dolby; String? flac; Dash.fromJson(Map json) { duration = json['duration']; minBufferTime = json['minBufferTime']; video = json['video'].map((e) => VideoItem.fromJson(e)).toList(); audio = json['audio'] != null ? json['audio'].map((e) => AudioItem.fromJson(e)).toList() : []; dolby = json['dolby']; flac = json['flac'] ?? ''; } } class VideoItem { VideoItem({ this.id, this.baseUrl, this.backupUrl, this.bandWidth, this.mimeType, this.codecs, this.width, this.height, this.frameRate, this.sar, this.startWithSap, this.segmentBase, this.codecid, this.quality, }); int? id; String? baseUrl; String? backupUrl; int? bandWidth; String? mimeType; String? codecs; int? width; int? height; String? frameRate; String? sar; int? startWithSap; Map? segmentBase; int? codecid; VideoQuality? quality; VideoItem.fromJson(Map json) { id = json['id']; baseUrl = json['baseUrl']; backupUrl = json['backupUrl'].toList().first; bandWidth = json['bandWidth']; mimeType = json['mime_type']; codecs = json['codecs']; width = json['width']; height = json['height']; frameRate = json['frameRate']; sar = json['sar']; startWithSap = json['startWithSap']; segmentBase = json['segmentBase']; codecid = json['codecid']; quality = VideoQuality.values.firstWhere((i) => i.code == json['id']); } } class AudioItem { AudioItem({ this.id, this.baseUrl, this.backupUrl, this.bandWidth, this.mimeType, this.codecs, this.width, this.height, this.frameRate, this.sar, this.startWithSap, this.segmentBase, this.codecid, this.quality, }); int? id; String? baseUrl; String? backupUrl; int? bandWidth; String? mimeType; String? codecs; int? width; int? height; String? frameRate; String? sar; int? startWithSap; Map? segmentBase; int? codecid; String? quality; AudioItem.fromJson(Map json) { id = json['id']; baseUrl = json['baseUrl']; backupUrl = json['backupUrl'].toList().first; bandWidth = json['bandWidth']; mimeType = json['mime_type']; codecs = json['codecs']; width = json['width']; height = json['height']; frameRate = json['frameRate']; sar = json['sar']; startWithSap = json['startWithSap']; segmentBase = json['segmentBase']; codecid = json['codecid']; quality = AudioQuality.values.firstWhere((i) => i.code == json['id']).description; } } class FormatItem { FormatItem({ this.quality, this.format, this.newDesc, this.displayDesc, this.codecs, }); int? quality; String? format; String? newDesc; String? displayDesc; List? codecs; FormatItem.fromJson(Map json) { quality = json['quality']; format = json['format']; newDesc = json['new_description']; displayDesc = json['display_desc']; codecs = json['codecs']; } }