Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
49dcd35
1
Parent(s):
e5ec20b
fix readme
Browse files- README.md +9 -3
- lib/screens/video_screen.dart +12 -1
README.md
CHANGED
@@ -1,12 +1,18 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
colorFrom: red
|
5 |
-
colorTo:
|
6 |
sdk: docker
|
7 |
app_file: api.py
|
8 |
pinned: true
|
9 |
short_description: A Latent YouTube
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
---
|
11 |
|
12 |
|
|
|
1 |
---
|
2 |
+
title: AiTube2
|
3 |
+
emoji: 🍿
|
4 |
colorFrom: red
|
5 |
+
colorTo: red
|
6 |
sdk: docker
|
7 |
app_file: api.py
|
8 |
pinned: true
|
9 |
short_description: A Latent YouTube
|
10 |
+
app_port: 8080
|
11 |
+
disable_embedding: false
|
12 |
+
hf_oauth: true
|
13 |
+
hf_oauth_expiration_minutes: 43200
|
14 |
+
hf_oauth_scopes:
|
15 |
+
- inference-api
|
16 |
---
|
17 |
|
18 |
|
lib/screens/video_screen.dart
CHANGED
@@ -88,6 +88,9 @@ class _VideoScreenState extends State<VideoScreen> {
|
|
88 |
}
|
89 |
}
|
90 |
|
|
|
|
|
|
|
91 |
Future<void> _onVideoSearch(String query) async {
|
92 |
if (!_isConnected) {
|
93 |
ScaffoldMessenger.of(context).showSnackBar(
|
@@ -99,9 +102,16 @@ class _VideoScreenState extends State<VideoScreen> {
|
|
99 |
setState(() => _isSearching = true);
|
100 |
|
101 |
try {
|
|
|
|
|
|
|
|
|
102 |
final result = await _websocketService.search(query);
|
|
|
103 |
if (mounted) {
|
104 |
setState(() {
|
|
|
|
|
105 |
_videoData = result;
|
106 |
_isSearching = false;
|
107 |
});
|
@@ -190,8 +200,9 @@ class _VideoScreenState extends State<VideoScreen> {
|
|
190 |
child: Column(
|
191 |
crossAxisAlignment: CrossAxisAlignment.start,
|
192 |
children: [
|
193 |
-
// Video Player
|
194 |
VideoPlayerWidget(
|
|
|
195 |
video: _videoData,
|
196 |
initialThumbnailUrl: _videoData.thumbnailUrl,
|
197 |
autoPlay: true,
|
|
|
88 |
}
|
89 |
}
|
90 |
|
91 |
+
// Reference to the current VideoPlayerWidget to force reset when needed
|
92 |
+
Key _videoPlayerKey = UniqueKey();
|
93 |
+
|
94 |
Future<void> _onVideoSearch(String query) async {
|
95 |
if (!_isConnected) {
|
96 |
ScaffoldMessenger.of(context).showSnackBar(
|
|
|
102 |
setState(() => _isSearching = true);
|
103 |
|
104 |
try {
|
105 |
+
// First, cancel any requests for the current video
|
106 |
+
_websocketService.cancelRequestsForVideo(_videoData.id);
|
107 |
+
|
108 |
+
// Get the search result
|
109 |
final result = await _websocketService.search(query);
|
110 |
+
|
111 |
if (mounted) {
|
112 |
setState(() {
|
113 |
+
// Generate a new key to force recreation of the VideoPlayerWidget
|
114 |
+
_videoPlayerKey = UniqueKey();
|
115 |
_videoData = result;
|
116 |
_isSearching = false;
|
117 |
});
|
|
|
200 |
child: Column(
|
201 |
crossAxisAlignment: CrossAxisAlignment.start,
|
202 |
children: [
|
203 |
+
// Video Player with unique key to force recreation when needed
|
204 |
VideoPlayerWidget(
|
205 |
+
key: _videoPlayerKey,
|
206 |
video: _videoData,
|
207 |
initialThumbnailUrl: _videoData.thumbnailUrl,
|
208 |
autoPlay: true,
|