refa: vertical video page (#328)

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
dom
2025-02-26 17:21:24 +08:00
committed by GitHub
parent 41f251ad50
commit 8434c488da
30 changed files with 2534 additions and 224 deletions

View File

@@ -27,6 +27,7 @@ import 'package:PiliPlus/utils/extension.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:dio/dio.dart';
import 'package:easy_debounce/easy_throttle.dart';
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
import 'package:floating/floating.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -126,6 +127,9 @@ class VideoDetailController extends GetxController
PlayerStatus? playerStatus;
StreamSubscription<Duration>? positionSubscription;
late final scrollKey = GlobalKey<ExtendedNestedScrollViewState>();
late final RxString direction = 'horizontal'.obs;
bool imageStatus = false;
void onViewImage() {
@@ -1082,6 +1086,11 @@ class VideoDetailController extends GetxController
baseUrl: videoUrl,
codecs: 'avc1',
quality: VideoQualityCode.fromCode(data.quality!)!);
direction.value = firstVideo.width != null && firstVideo.height != null
? firstVideo.width! > firstVideo.height!
? 'horizontal'
: 'vertical'
: 'horizontal';
currentDecodeFormats = VideoDecodeFormatsCode.fromString('avc1')!;
currentVideoQa = VideoQualityCode.fromCode(data.quality!)!;
if (autoPlay.value) {
@@ -1152,6 +1161,11 @@ class VideoDetailController extends GetxController
firstVideo = videosList.firstWhere(
(e) => e.codecs!.startsWith(currentDecodeFormats.code),
orElse: () => videosList.first);
direction.value = firstVideo.width != null && firstVideo.height != null
? firstVideo.width! > firstVideo.height!
? 'horizontal'
: 'vertical'
: 'horizontal';
// videoUrl = enableCDN
// ? VideoUtils.getCdnUrl(firstVideo)