mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-26 12:07:11 +08:00
@@ -378,7 +378,7 @@ class LiveRoomController extends GetxController {
|
||||
case 'SUPER_CHAT_MESSAGE' when (showSuperChat):
|
||||
final item = SuperChatItem.fromJson(obj['data']);
|
||||
superChatMsg.insert(0, item);
|
||||
if (isFullScreen) {
|
||||
if (isFullScreen || plPlayerController.isDesktopPip) {
|
||||
fsSC.value = item;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
|
||||
@@ -211,45 +212,48 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
Alignment? alignment,
|
||||
bool needDm = true,
|
||||
}) {
|
||||
if (!isFullScreen) {
|
||||
if (!isFullScreen && !plPlayerController.isDesktopPip) {
|
||||
_liveRoomController.fsSC.value = null;
|
||||
}
|
||||
_liveRoomController.isFullScreen = isFullScreen;
|
||||
Widget player = Obx(() {
|
||||
if (_liveRoomController.isLoaded.value) {
|
||||
final roomInfoH5 = _liveRoomController.roomInfoH5.value;
|
||||
return PLVideoPlayer(
|
||||
key: playerKey,
|
||||
maxWidth: width,
|
||||
maxHeight: height,
|
||||
fill: fill,
|
||||
alignment: alignment,
|
||||
plPlayerController: plPlayerController,
|
||||
headerControl: LiveHeaderControl(
|
||||
title: roomInfoH5?.roomInfo?.title,
|
||||
upName: roomInfoH5?.anchorInfo?.baseInfo?.uname,
|
||||
Widget player = Obx(
|
||||
key: playerKey,
|
||||
() {
|
||||
if (_liveRoomController.isLoaded.value) {
|
||||
final roomInfoH5 = _liveRoomController.roomInfoH5.value;
|
||||
return PLVideoPlayer(
|
||||
maxWidth: width,
|
||||
maxHeight: height,
|
||||
fill: fill,
|
||||
alignment: alignment,
|
||||
plPlayerController: plPlayerController,
|
||||
onSendDanmaku: _liveRoomController.onSendDanmaku,
|
||||
onPlayAudio: _liveRoomController.queryLiveUrl,
|
||||
),
|
||||
bottomControl: BottomControl(
|
||||
plPlayerController: plPlayerController,
|
||||
liveRoomCtr: _liveRoomController,
|
||||
onRefresh: _liveRoomController.queryLiveUrl,
|
||||
),
|
||||
danmuWidget: !needDm
|
||||
? null
|
||||
: LiveDanmaku(
|
||||
liveRoomController: _liveRoomController,
|
||||
plPlayerController: plPlayerController,
|
||||
isFullScreen: isFullScreen,
|
||||
isPipMode: isPipMode,
|
||||
),
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
});
|
||||
if (isFullScreen && _liveRoomController.showSuperChat) {
|
||||
headerControl: LiveHeaderControl(
|
||||
title: roomInfoH5?.roomInfo?.title,
|
||||
upName: roomInfoH5?.anchorInfo?.baseInfo?.uname,
|
||||
plPlayerController: plPlayerController,
|
||||
onSendDanmaku: _liveRoomController.onSendDanmaku,
|
||||
onPlayAudio: _liveRoomController.queryLiveUrl,
|
||||
),
|
||||
bottomControl: BottomControl(
|
||||
plPlayerController: plPlayerController,
|
||||
liveRoomCtr: _liveRoomController,
|
||||
onRefresh: _liveRoomController.queryLiveUrl,
|
||||
),
|
||||
danmuWidget: !needDm
|
||||
? null
|
||||
: LiveDanmaku(
|
||||
liveRoomController: _liveRoomController,
|
||||
plPlayerController: plPlayerController,
|
||||
isFullScreen: isFullScreen,
|
||||
isPipMode: isPipMode,
|
||||
),
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
);
|
||||
if (_liveRoomController.showSuperChat &&
|
||||
(isFullScreen || plPlayerController.isDesktopPip)) {
|
||||
player = Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
@@ -421,6 +425,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
final isFullScreen = this.isFullScreen;
|
||||
final height = maxWidth * 9 / 16;
|
||||
final videoHeight = isFullScreen ? maxHeight : height;
|
||||
final bottomHeight = maxHeight - padding.top - height - kToolbarHeight;
|
||||
return Column(
|
||||
children: [
|
||||
Offstage(
|
||||
@@ -440,7 +445,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
offstage: isFullScreen,
|
||||
child: SizedBox(
|
||||
width: maxWidth,
|
||||
height: maxHeight - padding.top - height - kToolbarHeight,
|
||||
height: max(0, bottomHeight),
|
||||
child: _buildBottomWidget,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -47,7 +47,7 @@ mixin TripleMixin on GetxController, TickerProvider {
|
||||
|
||||
static final _duration = Utils.isMobile
|
||||
? const Duration(milliseconds: 200)
|
||||
: const Duration(milliseconds: 230);
|
||||
: const Duration(milliseconds: 255);
|
||||
|
||||
void onStartTriple() {
|
||||
_timer ??= Timer(_duration, () {
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart'
|
||||
show KeyDownEvent, KeyUpEvent, LogicalKeyboardKey;
|
||||
show KeyDownEvent, KeyUpEvent, LogicalKeyboardKey, HardwareKeyboard;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -131,6 +131,18 @@ class PlayerFocus extends StatelessWidget {
|
||||
}
|
||||
|
||||
if (event is KeyDownEvent) {
|
||||
final isDigit1 = key == LogicalKeyboardKey.digit1;
|
||||
if (isDigit1 || key == LogicalKeyboardKey.digit2) {
|
||||
if (HardwareKeyboard.instance.isShiftPressed && hasPlayer) {
|
||||
final speed = isDigit1 ? 1.0 : 2.0;
|
||||
if (speed != plPlayerController.playbackSpeed) {
|
||||
plPlayerController.setPlaybackSpeed(speed);
|
||||
SmartDialog.showToast('${speed}x播放');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case LogicalKeyboardKey.space:
|
||||
if (plPlayerController.isLive || canPlay!()) {
|
||||
@@ -170,8 +182,10 @@ class PlayerFocus extends StatelessWidget {
|
||||
}
|
||||
return true;
|
||||
|
||||
case LogicalKeyboardKey.keyP when (Utils.isDesktop && hasPlayer):
|
||||
plPlayerController.toggleDesktopPip();
|
||||
case LogicalKeyboardKey.keyP:
|
||||
if (Utils.isDesktop && hasPlayer) {
|
||||
plPlayerController.toggleDesktopPip();
|
||||
}
|
||||
return true;
|
||||
|
||||
case LogicalKeyboardKey.keyM:
|
||||
@@ -185,6 +199,12 @@ class PlayerFocus extends StatelessWidget {
|
||||
}
|
||||
return true;
|
||||
|
||||
case LogicalKeyboardKey.keyS:
|
||||
if (hasPlayer && isFullScreen) {
|
||||
plPlayerController.takeScreenshot();
|
||||
}
|
||||
return true;
|
||||
|
||||
case LogicalKeyboardKey.enter:
|
||||
onSendDanmaku();
|
||||
return true;
|
||||
@@ -218,6 +238,14 @@ class PlayerFocus extends StatelessWidget {
|
||||
}
|
||||
return true;
|
||||
|
||||
case LogicalKeyboardKey.keyL:
|
||||
if (isFullScreen || plPlayerController.isDesktopPip) {
|
||||
plPlayerController.onLockControl(
|
||||
!plPlayerController.controlsLock.value,
|
||||
);
|
||||
}
|
||||
return true;
|
||||
|
||||
case LogicalKeyboardKey.bracketLeft:
|
||||
if (introController case final introController?) {
|
||||
if (!introController.prevPlay()) {
|
||||
|
||||
Reference in New Issue
Block a user