From 2329e7344e3038ac5d8031ab5c5802ab1eb6ac5a Mon Sep 17 00:00:00 2001 From: orz12 Date: Fri, 22 Mar 2024 13:42:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=9B=B4=E6=92=AD=E9=97=B4=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=88=B7=E6=96=B0=E3=80=81=E5=86=85=E7=BD=AE=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/live_room/view.dart | 31 ++++++++++++++++++++++++++++ lib/pages/webview/controller.dart | 9 ++++++++ lib/plugin/pl_player/controller.dart | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/lib/pages/live_room/view.dart b/lib/pages/live_room/view.dart index 820c9f6b..19fa6a8e 100644 --- a/lib/pages/live_room/view.dart +++ b/lib/pages/live_room/view.dart @@ -164,6 +164,37 @@ class _LiveRoomPageState extends State { ), ], ), + const Spacer(), + //刷新 + IconButton( + tooltip: '刷新', + onPressed: () { + _futureBuilderFuture = + _liveRoomController.queryLiveInfo(); + // videoSourceInit(); + }, + icon: const Icon(Icons.refresh), + ), + //内置浏览器打开 + IconButton( + tooltip: '内置浏览器打开', + onPressed: () { + Get.toNamed( + '/webview', + parameters: { + 'url': + 'https://live.bilibili.com/h5/${_liveRoomController.roomId}', + 'type': 'liveRoom', + 'pageTitle': _liveRoomController + .roomInfoH5 + .value + .anchorInfo! + .baseInfo! + .uname!, + }, + ); + }, + icon: const Icon(Icons.open_in_browser)), ], ), ); diff --git a/lib/pages/webview/controller.dart b/lib/pages/webview/controller.dart index 43486876..d751c089 100644 --- a/lib/pages/webview/controller.dart +++ b/lib/pages/webview/controller.dart @@ -64,6 +64,15 @@ class WebviewController extends GetxController { } } }, + onPageFinished: (String url) { + if (type.value == 'liveRoom') { + print("adding"); + //注入js + controller.runJavaScriptReturningResult(''' + document.styleSheets[0].insertRule('div.open-app-btn.bili-btn-warp {display:none;}', 0); + ''').then((value) => print(value)); + } + }, // 加载完成 onUrlChange: (UrlChange urlChange) async { loadShow.value = false; diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 6a709456..8cced838 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -385,7 +385,7 @@ class PlPlayerController { startListeners(); } await _initializePlayer(seekTo: seekTo, duration: _duration.value); - if (videoType.value != 'live') { + if (videoType.value != 'live' && _cid != 0) { refreshSubtitles().then((value) { if (_vttSubtitles.isNotEmpty){ String preference = setting.get(SettingBoxKey.subtitlePreference,