Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

android video page debug

Predidit0102bff49925
diff --git a/lib/pages/video/video_page.dart b/lib/pages/video/video_page.dart
index e887638e..e56526ac 100644
--- a/lib/pages/video/video_page.dart
+++ b/lib/pages/video/video_page.dart
@@ -72,181 +72,197 @@ class _VideoPageState extends State<VideoPage>
}
});
return SafeArea(
- child: Scaffold(
- appBar: (videoPageController.currentPlugin.useNativePlayer ? null : SysAppBar()),
- body: Column(
- children: [
- Observer(builder: (context) {
- return Container(
- color: Colors.black,
- height: MediaQuery.of(context).size.width * 9 / 16,
- width: MediaQuery.of(context).size.width,
- child: Stack(
- children: [
- Positioned.fill(
- child: Visibility(
- visible: videoPageController.loading,
- child: (!videoPageController.currentPlugin.useNativePlayer)
- ? Container(
- color: Colors.black,
- child: const Center(
- child: CircularProgressIndicator()))
- : Container(),
- )),
- Positioned.fill(
- child: (!videoPageController.currentPlugin.useNativePlayer || playerController.loading)
- ? Container()
- : const PlayerItem(),
- ),
- Positioned(
- child: SizedBox(
- height: (videoPageController.loading ||
- videoPageController.currentPlugin.useNativePlayer)
- ? 0
- : null,
- child: Platform.isWindows
- ? const WebviewDesktopItem()
- : const WebviewItem(),
- ))
- ],
+ child: Observer(
+ builder: (context) {
+ return Scaffold(
+ appBar: ((videoPageController.currentPlugin.useNativePlayer ||
+ videoPageController.androidFullscreen)
+ ? null
+ : SysAppBar()),
+ body: Column(
+ children: [
+ Container(
+ color: Colors.black,
+ height: MediaQuery.of(context).size.width * 9 / 16,
+ width: MediaQuery.of(context).size.width,
+ child: Stack(
+ children: [
+ Positioned.fill(
+ child: Visibility(
+ visible: videoPageController.loading,
+ child: (!videoPageController.currentPlugin.useNativePlayer)
+ ? Container(
+ color: Colors.black,
+ child: const Center(
+ child: CircularProgressIndicator()))
+ : Container(),
+ )),
+ Positioned.fill(
+ child:
+ (!videoPageController.currentPlugin.useNativePlayer ||
+ playerController.loading)
+ ? Container()
+ : const PlayerItem(),
+ ),
+ Positioned(
+ child: SizedBox(
+ height: (videoPageController.loading ||
+ videoPageController.currentPlugin.useNativePlayer)
+ ? 0
+ : null,
+ child: Platform.isWindows
+ ? const WebviewDesktopItem()
+ : const WebviewItem(),
+ ))
+ ],
+ ),
),
- );
- }),
- videoPageController.androidFullscreen ? Container() : Expanded(
- child: Observer(
- builder: (context) => TabBarView(
- controller: tabController,
- children: List.generate(videoPageController.roadList.length,
- (roadIndex) {
- var cardList = <Widget>[];
- for (var road in videoPageController.roadList) {
- if (road.name == '播放列表${roadIndex + 1}') {
- int count = 1;
- for (var urlItem in road.data) {
- int _count = count;
- cardList.add(Container(
- margin:
- const EdgeInsets.only(bottom: 10), // 改为bottom间距
- child: Material(
- color:
- Theme.of(context).colorScheme.onInverseSurface,
- borderRadius: BorderRadius.circular(6),
- clipBehavior: Clip.hardEdge,
- child: InkWell(
- onTap: () async {
- debugPrint('视频链接为 $urlItem');
- videoPageController.changeEpisode(_count,
- currentRoad: roadIndex);
- },
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 8, horizontal: 10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: [
- if (_count ==
- (videoPageController
- .currentEspisode)) ...<Widget>[
- Image.asset(
- 'assets/images/live.png',
- color: Theme.of(context)
- .colorScheme
- .primary,
- height: 12,
- ),
- const SizedBox(width: 6)
- ],
- Text(
- '第$count话',
- style: TextStyle(
- fontSize: 13,
- color: _count ==
+
+ videoPageController.androidFullscreen
+ ? Container()
+ : Expanded(
+ child: Observer(
+ builder: (context) => TabBarView(
+ controller: tabController,
+ children: List.generate(
+ videoPageController.roadList.length, (roadIndex) {
+ var cardList = <Widget>[];
+ for (var road in videoPageController.roadList) {
+ if (road.name == '播放列表${roadIndex + 1}') {
+ int count = 1;
+ for (var urlItem in road.data) {
+ int _count = count;
+ cardList.add(Container(
+ margin: const EdgeInsets.only(
+ bottom: 10), // 改为bottom间距
+ child: Material(
+ color: Theme.of(context)
+ .colorScheme
+ .onInverseSurface,
+ borderRadius: BorderRadius.circular(6),
+ clipBehavior: Clip.hardEdge,
+ child: InkWell(
+ onTap: () async {
+ debugPrint('视频链接为 $urlItem');
+ videoPageController.changeEpisode(
+ _count,
+ currentRoad: roadIndex);
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ vertical: 8, horizontal: 10),
+ child: Column(
+ crossAxisAlignment:
+ CrossAxisAlignment.start,
+ children: <Widget>[
+ Row(
+ children: [
+ if (_count ==
(videoPageController
- .currentEspisode)
- ? Theme.of(context)
- .colorScheme
- .primary
- : Theme.of(context)
- .colorScheme
- .onSurface),
+ .currentEspisode)) ...<Widget>[
+ Image.asset(
+ 'assets/images/live.png',
+ color: Theme.of(context)
+ .colorScheme
+ .primary,
+ height: 12,
+ ),
+ const SizedBox(width: 6)
+ ],
+ Text(
+ '第$count话',
+ style: TextStyle(
+ fontSize: 13,
+ color: _count ==
+ (videoPageController
+ .currentEspisode)
+ ? Theme.of(context)
+ .colorScheme
+ .primary
+ : Theme.of(context)
+ .colorScheme
+ .onSurface),
+ ),
+ const SizedBox(width: 2),
+ ],
+ ),
+ const SizedBox(height: 3),
+ ],
+ ),
),
- const SizedBox(width: 2),
- ],
+ ),
+ ),
+ ));
+ count++;
+ }
+ }
+ }
+ // return ListView(children: cardList);
+ return GridView.builder(
+ scrollDirection: Axis.vertical,
+ gridDelegate:
+ SliverGridDelegateWithFixedCrossAxisCount(
+ crossAxisCount: Platform.isWindows ||
+ Platform.isLinux ||
+ Platform.isMacOS
+ ? 10
+ : 3,
+ crossAxisSpacing: 10,
+ mainAxisSpacing: 5,
+ childAspectRatio: 1.7,
+ ),
+ itemCount: cardList.length,
+ itemBuilder: (context, index) {
+ return cardList[index];
+ },
+ );
+ }),
+ ),
+ ),
+ ),
+ videoPageController.androidFullscreen
+ ? Container()
+ : TabBar(
+ isScrollable: true,
+ tabAlignment: TabAlignment.center,
+ controller: tabController,
+ tabs: videoPageController.roadList
+ .map((road) => Observer(
+ builder: (context) => Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ road.name,
+ overflow: TextOverflow.ellipsis,
),
- const SizedBox(height: 3),
],
),
- ),
- ),
- ),
- ));
- count++;
- }
- }
- }
- // return ListView(children: cardList);
- return GridView.builder(
- scrollDirection: Axis.vertical,
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: Platform.isWindows ||
- Platform.isLinux ||
- Platform.isMacOS
- ? 10
- : 3,
- crossAxisSpacing: 10,
- mainAxisSpacing: 5,
- childAspectRatio: 1.7,
+ ))
+ .toList(),
),
- itemCount: cardList.length,
- itemBuilder: (context, index) {
- return cardList[index];
- },
- );
- }),
- ),
- ),
- ),
- videoPageController.androidFullscreen ? Container() : TabBar(
- isScrollable: true,
- tabAlignment: TabAlignment.center,
- controller: tabController,
- tabs: videoPageController.roadList
- .map((road) => Observer(
- builder: (context) => Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- road.name,
- overflow: TextOverflow.ellipsis,
- ),
- ],
- ),
- ))
- .toList(),
+ // InkWell(
+ // child: const Card(
+ // child: ListTile(
+ // title: Text('刮削测试'),
+ // ),
+ // ),
+ // onTap: () async {
+ // if (Platform.isWindows) {
+ // final WebviewDesktopItemController
+ // webviewDesktopItemController =
+ // Modular.get<WebviewDesktopItemController>();
+ // await webviewDesktopItemController.parseIframeUrl();
+ // } else {
+ // final WebviewItemController webviewItemController =
+ // Modular.get<WebviewItemController>();
+ // await webviewItemController.parseIframeUrl();
+ // }
+ // },
+ // )
+ ],
),
- // InkWell(
- // child: const Card(
- // child: ListTile(
- // title: Text('刮削测试'),
- // ),
- // ),
- // onTap: () async {
- // if (Platform.isWindows) {
- // final WebviewDesktopItemController
- // webviewDesktopItemController =
- // Modular.get<WebviewDesktopItemController>();
- // await webviewDesktopItemController.parseIframeUrl();
- // } else {
- // final WebviewItemController webviewItemController =
- // Modular.get<WebviewItemController>();
- // await webviewItemController.parseIframeUrl();
- // }
- // },
- // )
- ],
- ),
+ );
+ }
),
);
}
diff --git a/lib/pages/webview_desktop/webview_desktop_item.dart b/lib/pages/webview_desktop/webview_desktop_item.dart
index ad04d1d0..8bfe97ae 100644
--- a/lib/pages/webview_desktop/webview_desktop_item.dart
+++ b/lib/pages/webview_desktop/webview_desktop_item.dart
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:webview_windows/webview_windows.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:window_manager/window_manager.dart';
+import 'package:kazumi/pages/video/video_controller.dart';
import 'package:kazumi/pages/webview_desktop/webview_desktop_controller.dart';
class WebviewDesktopItem extends StatefulWidget {
@@ -17,6 +18,7 @@ class _WebviewDesktopItemState extends State<WebviewDesktopItem> {
final List<StreamSubscription> _subscriptions = [];
final WebviewDesktopItemController webviewDesktopItemController =
Modular.get<WebviewDesktopItemController>();
+ final VideoPageController videoPageController = Modular.get<VideoPageController>();
@override
void initState() {
@@ -40,6 +42,7 @@ class _WebviewDesktopItemState extends State<WebviewDesktopItem> {
.webviewController.containsFullScreenElementChanged
.listen((flag) {
debugPrint('包括可全屏元素: $flag');
+ videoPageController.androidFullscreen = flag;
windowManager.setFullScreen(flag);
}));
if (!mounted) return;