Skip to content

Commit

Permalink
🐛 FIX:
Browse files Browse the repository at this point in the history
  • Loading branch information
moxun33 committed Aug 18, 2024
1 parent 6d8d525 commit 8e1d855
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 5 additions & 4 deletions lib/pages/home/home_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class HomeController extends GetxController with WindowListener {
PlayListItem? playingUrl;

bool danmakuManualShow = true;
List<String> msgs = []; //左上角的文字提示列表
String tip = ''; //左上角的单个文字提示,如成功、失败
List<String> msgs = []; //左上角的文字提示列表,如 媒体信息
Map<String, String> extraMetaInfo = {}; //额外的元数据
Hackchat? hc;
@override
Expand Down Expand Up @@ -188,7 +189,7 @@ class HomeController extends GetxController with WindowListener {

return;
}
msgs = ['正在打开${item.name ?? ''}'];
tip = '正在打开${item.name ?? ''}';
update();
final settings = await LoacalStorage().getJSON(PLAYER_SETTINGS);

Expand All @@ -208,7 +209,7 @@ class HomeController extends GetxController with WindowListener {
player.onMediaStatus((MediaStatus oldStatus, MediaStatus status) {
debugPrint("============接收到media status改变 $status");
if (status.toString() == 'MediaStatus(+invalid)') {
msgs = ['${item.name}播放失败'];
tip = '${item.name}播放失败';
stopPlayer();
update();
}
Expand All @@ -221,7 +222,7 @@ class HomeController extends GetxController with WindowListener {
extraMetaInfo[e.category] = e.detail;
switch (e.category) {
case 'reader.buffering':
msgs = value < 100 ? ['缓冲 $value%'] : [];
tip = value < 100 ? '缓冲 $value%' : '';

break;
case 'render.video':
Expand Down
7 changes: 5 additions & 2 deletions lib/pages/home/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class HomePage extends GetView<HomeController> {
HomePage({Key? key}) : super(key: key);
// 信息展示
Widget OsdMsg() {
final msgs = controller.msgs;
final msgs = [controller.tip] + controller.msgs;
return Container(
padding: const EdgeInsets.all(10),
width: controller.getDanmakuSize().width,
Expand All @@ -36,7 +36,10 @@ class HomePage extends GetView<HomeController> {
children: msgs.map((txt) {
return Text(
txt,
style: TextStyle(color: Colors.amber[600], fontSize: 20),
style: TextStyle(
color: Colors.white,
fontSize: 20,
overflow: TextOverflow.ellipsis),
);
}).toList()));
}
Expand Down

0 comments on commit 8e1d855

Please sign in to comment.