switch live stream/format/codec/url support

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-06-11 12:16:24 +08:00
parent aa35569ebe
commit ea5d7593ff
11 changed files with 318 additions and 99 deletions

View File

@@ -1,18 +1,18 @@
import 'package:PiliPlus/models_new/live/live_dm_info/host_list.dart';
class LiveDmInfoData {
String? token;
List<HostList>? hostList;
String token;
List<HostList> hostList;
LiveDmInfoData({
this.token,
this.hostList,
required this.token,
required this.hostList,
});
factory LiveDmInfoData.fromJson(Map<String, dynamic> json) => LiveDmInfoData(
token: json['token'] as String?,
hostList: (json['host_list'] as List<dynamic>?)
?.map((e) => HostList.fromJson(e as Map<String, dynamic>))
token: json['token'] as String,
hostList: (json['host_list'] as List<dynamic>)
.map((e) => HostList.fromJson(e as Map<String, dynamic>))
.toList(),
);
}

View File

@@ -2,24 +2,27 @@ import 'package:PiliPlus/models_new/live/live_room_play_info/url_info.dart';
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
class CodecItem {
int? currentQn;
List<int>? acceptQn;
String? baseUrl;
List<UrlInfo>? urlInfo;
String? codecName;
int currentQn;
List<int> acceptQn;
String baseUrl;
List<UrlInfo> urlInfo;
CodecItem({
this.currentQn,
this.acceptQn,
this.baseUrl,
this.urlInfo,
this.codecName,
required this.currentQn,
required this.acceptQn,
required this.baseUrl,
required this.urlInfo,
});
factory CodecItem.fromJson(Map<String, dynamic> json) => CodecItem(
currentQn: json['current_qn'] as int?,
acceptQn: (json['accept_qn'] as List?)?.fromCast(),
baseUrl: json['base_url'] as String?,
urlInfo: (json['url_info'] as List<dynamic>?)
?.map((e) => UrlInfo.fromJson(e as Map<String, dynamic>))
codecName: json['codec_name'],
currentQn: json['current_qn'] as int,
acceptQn: (json['accept_qn'] as List).fromCast(),
baseUrl: json['base_url'] as String,
urlInfo: (json['url_info'] as List<dynamic>)
.map((e) => UrlInfo.fromJson(e as Map<String, dynamic>))
.toList(),
);
}

View File

@@ -1,13 +1,18 @@
import 'package:PiliPlus/models_new/live/live_room_play_info/codec.dart';
class Format {
List<CodecItem>? codec;
String? formatName;
List<CodecItem> codec;
Format({this.codec});
Format({
this.formatName,
required this.codec,
});
factory Format.fromJson(Map<String, dynamic> json) => Format(
codec: (json['codec'] as List<dynamic>?)
?.map((e) => CodecItem.fromJson(e as Map<String, dynamic>))
formatName: json['format_name'],
codec: (json['codec'] as List<dynamic>)
.map((e) => CodecItem.fromJson(e as Map<String, dynamic>))
.toList(),
);
}

View File

@@ -1,15 +1,15 @@
import 'package:PiliPlus/models_new/live/live_room_play_info/stream.dart';
class Playurl {
List<Stream>? stream;
List<Stream> stream;
Playurl({
this.stream,
required this.stream,
});
factory Playurl.fromJson(Map<String, dynamic> json) => Playurl(
stream: (json['stream'] as List<dynamic>?)
?.map((e) => Stream.fromJson(e as Map<String, dynamic>))
stream: (json['stream'] as List<dynamic>)
.map((e) => Stream.fromJson(e as Map<String, dynamic>))
.toList(),
);
}

View File

@@ -1,13 +1,15 @@
import 'package:PiliPlus/models_new/live/live_room_play_info/format.dart';
class Stream {
List<Format>? format;
String? protocolName;
List<Format> format;
Stream({this.format});
Stream({this.protocolName, required this.format});
factory Stream.fromJson(Map<String, dynamic> json) => Stream(
format: (json['format'] as List<dynamic>?)
?.map((e) => Format.fromJson(e as Map<String, dynamic>))
protocolName: json['protocol_name'],
format: (json['format'] as List<dynamic>)
.map((e) => Format.fromJson(e as Map<String, dynamic>))
.toList(),
);
}

View File

@@ -1,11 +1,11 @@
class UrlInfo {
String? host;
String? extra;
String host;
String extra;
UrlInfo({this.host, this.extra});
UrlInfo({required this.host, required this.extra});
factory UrlInfo.fromJson(Map<String, dynamic> json) => UrlInfo(
host: json['host'] as String?,
extra: json['extra'] as String?,
host: json['host'] as String,
extra: json['extra'] as String,
);
}