mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: video widget
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -754,7 +754,7 @@ class PlPlayerController {
|
||||
play: false,
|
||||
);
|
||||
} else {
|
||||
await player.open(
|
||||
player.open(
|
||||
Media(dataSource.videoSource!,
|
||||
httpHeaders: dataSource.httpHeaders, start: seekTo),
|
||||
play: false,
|
||||
@@ -1564,8 +1564,7 @@ class PlPlayerController {
|
||||
var pp = _videoPlayerController!.platform as NativePlayer;
|
||||
await pp.setProperty('audio-files', '');
|
||||
removeListeners();
|
||||
await _videoPlayerController?.stop();
|
||||
await _videoPlayerController?.dispose();
|
||||
await _videoPlayerController!.dispose();
|
||||
_videoPlayerController = null;
|
||||
}
|
||||
_instance = null;
|
||||
|
||||
@@ -710,16 +710,23 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
key: _playerKey,
|
||||
children: <Widget>[
|
||||
Obx(
|
||||
() => InteractiveViewer(
|
||||
() => Video(
|
||||
fill: widget.fill ?? Colors.black,
|
||||
key: key,
|
||||
alignment: widget.alignment ?? Alignment.center,
|
||||
controller: videoController,
|
||||
controls: NoVideoControls,
|
||||
pauseUponEnteringBackgroundMode:
|
||||
!plPlayerController.continuePlayInBackground.value,
|
||||
resumeUponEnteringForegroundMode: true,
|
||||
// 字幕尺寸调节
|
||||
subtitleViewConfiguration:
|
||||
plPlayerController.subtitleViewConfiguration,
|
||||
fit: plPlayerController.videoFit.value,
|
||||
dmWidget: widget.danmuWidget,
|
||||
transformationController: transformationController,
|
||||
panEnabled: false, // 启用平移 //单指平移会与横竖手势冲突
|
||||
scaleEnabled: !plPlayerController.controlsLock.value, // 启用缩放
|
||||
minScale: plPlayerController.enableShrinkVideoSize ? 0.75 : 1,
|
||||
maxScale: 2.0,
|
||||
boundaryMargin: plPlayerController.enableShrinkVideoSize
|
||||
? const EdgeInsets.all(double.infinity)
|
||||
: EdgeInsets.zero,
|
||||
panAxis: PanAxis.aligned,
|
||||
scaleEnabled: !plPlayerController.controlsLock.value,
|
||||
enableShrinkVideoSize: plPlayerController.enableShrinkVideoSize,
|
||||
onInteractionStart: (ScaleStartDetails details) {
|
||||
if (plPlayerController.controlsLock.value) return;
|
||||
// 如果起点太靠上则屏蔽
|
||||
@@ -731,7 +738,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
// debugPrint("_initialFocalPoint$_initialFocalPoint");
|
||||
_gestureType = null;
|
||||
},
|
||||
|
||||
onInteractionUpdate: (ScaleUpdateDetails details) {
|
||||
showRestoreScaleBtn.value =
|
||||
transformationController.value.row0.x != 1.0;
|
||||
@@ -914,25 +920,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
_initialFocalPoint = Offset.zero;
|
||||
_gestureType = null;
|
||||
},
|
||||
child: Transform.flip(
|
||||
flipX: plPlayerController.flipX.value,
|
||||
flipY: plPlayerController.flipY.value,
|
||||
child: Video(
|
||||
fill: widget.fill ?? Colors.black,
|
||||
key: key,
|
||||
alignment: widget.alignment ?? Alignment.center,
|
||||
controller: videoController,
|
||||
controls: NoVideoControls,
|
||||
pauseUponEnteringBackgroundMode:
|
||||
!plPlayerController.continuePlayInBackground.value,
|
||||
resumeUponEnteringForegroundMode: true,
|
||||
// 字幕尺寸调节
|
||||
subtitleViewConfiguration:
|
||||
plPlayerController.subtitleViewConfiguration,
|
||||
fit: plPlayerController.videoFit.value,
|
||||
dmWidget: widget.danmuWidget,
|
||||
),
|
||||
),
|
||||
flipX: plPlayerController.flipX.value,
|
||||
flipY: plPlayerController.flipY.value,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1302,18 +1291,21 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
),
|
||||
|
||||
// if (BuildConfig.isDebug)
|
||||
// FilledButton.tonal(
|
||||
// Positioned(
|
||||
// right: 25,
|
||||
// top: 125,
|
||||
// child: FilledButton.tonal(
|
||||
// onPressed: () {
|
||||
// transformationController.value = Matrix4.identity()
|
||||
// ..translate(0.5, 0.5)
|
||||
// ..scale(1.2)
|
||||
// ..translate(-0.5, -0.5);
|
||||
|
||||
// plPlayerController.videoScale.value =
|
||||
// transformationController.value.row0.x;
|
||||
// showRestoreScaleBtn.value = true;
|
||||
// },
|
||||
// child: const Text('scale'),
|
||||
// ),
|
||||
// ),
|
||||
|
||||
Obx(
|
||||
() =>
|
||||
|
||||
@@ -1204,7 +1204,7 @@ packages:
|
||||
description:
|
||||
path: media_kit_video
|
||||
ref: "version_1.3.0"
|
||||
resolved-ref: "979051686b6a31a6aa8f7f9aa2202a86cabddeca"
|
||||
resolved-ref: "961752a300c67580a976874a604e4129f78a208c"
|
||||
url: "https://github.com/bggRGjQaUbCoE/media-kit.git"
|
||||
source: git
|
||||
version: "1.3.0"
|
||||
|
||||
Reference in New Issue
Block a user