现阶段基础播放能力已经实现,接下来将尽全力往UI方向再调整一下
This commit is contained in:
@@ -72,14 +72,24 @@ class _WebDAVFileListPageState extends State<WebDAVFileListPage> {
|
||||
try {
|
||||
final url = WebDAVService.instance.getFileUrl(file.path);
|
||||
|
||||
// ✅ 硬编码认证头(与 home_page 保持一致)
|
||||
final testHeaders = {
|
||||
'Authorization':
|
||||
'Basic ' + base64Encode(utf8.encode('test-user-1:Lxh10020328?')),
|
||||
};
|
||||
// ✅ 动态获取认证头(从 SharedPreferences 读取)
|
||||
final headers = await WebDAVService.instance.getAuthHeaders();
|
||||
|
||||
if (headers.isEmpty) {
|
||||
print('⚠️ 未获取到认证头,请检查 WebDAV 登录状态');
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('请先登录 WebDAV'),
|
||||
backgroundColor: Colors.orange,
|
||||
),
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
print('🎵 [文件列表] 播放 URL: $url');
|
||||
print('📋 [文件列表] 认证头已设置');
|
||||
print('📋 [文件列表] 认证头已设置: ${headers.keys}');
|
||||
|
||||
final song = Song(
|
||||
id: file.path,
|
||||
@@ -89,7 +99,7 @@ class _WebDAVFileListPageState extends State<WebDAVFileListPage> {
|
||||
);
|
||||
context.read<AudioService>().playSong(song);
|
||||
|
||||
await PlaybackService().play(url, headers: testHeaders);
|
||||
await PlaybackService().play(url, headers: headers);
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
|
||||
Reference in New Issue
Block a user