Skip to content

Commit

Permalink
feat: 直播间新增刷新、内置浏览器打开
Browse files Browse the repository at this point in the history
  • Loading branch information
orz12 committed Mar 22, 2024
1 parent fec6a18 commit 2329e73
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
31 changes: 31 additions & 0 deletions lib/pages/live_room/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,37 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
),
],
),
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)),
],
),
);
Expand Down
9 changes: 9 additions & 0 deletions lib/pages/webview/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin/pl_player/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2329e73

Please sign in to comment.