mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-15 23:10:09 +08:00
switch live stream/format/codec/url support
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -64,4 +64,8 @@ extension ListExt<T> on List<T> {
|
||||
if (index < 0 || index >= length) return null;
|
||||
return this[index];
|
||||
}
|
||||
|
||||
T getOrFirst(int index) {
|
||||
return getOrNull(index) ?? first;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:PiliPlus/models/common/video/cdn_type.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_room_play_info/codec.dart';
|
||||
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode, debugPrint;
|
||||
|
||||
@@ -88,9 +89,8 @@ abstract final class VideoUtils {
|
||||
.toString();
|
||||
}
|
||||
|
||||
static String getLiveCdnUrl(CodecItem e) {
|
||||
return (liveCdnUrl ?? e.urlInfo!.first.host!) +
|
||||
e.baseUrl! +
|
||||
e.urlInfo!.first.extra!;
|
||||
static String getLiveCdnUrl(CodecItem e, {int index = 0}) {
|
||||
final urlInfo = e.urlInfo.getOrFirst(index);
|
||||
return (liveCdnUrl ?? urlInfo.host) + e.baseUrl + urlInfo.extra;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user