From a8cea638641809a4f403b49c39489a34edb02330 Mon Sep 17 00:00:00 2001 From: bigzhu Date: Thu, 7 Dec 2023 15:18:06 +0800 Subject: [PATCH 01/20] remove videoTitle IgnorePointer --- .../Flutter/GeneratedPluginRegistrant.swift | 4 +++- .../widgets/core/overlays/mobile_overlay.dart | 12 +++------- .../widgets/core/overlays/web_overlay.dart | 22 ++++++------------- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index f26940ad..8e40e9f0 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,9 +6,11 @@ import FlutterMacOS import Foundation import package_info_plus +import video_player_avfoundation import wakelock_plus func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) + FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) + FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) } diff --git a/lib/src/widgets/core/overlays/mobile_overlay.dart b/lib/src/widgets/core/overlays/mobile_overlay.dart index 1afe558d..a1fa0dbd 100644 --- a/lib/src/widgets/core/overlays/mobile_overlay.dart +++ b/lib/src/widgets/core/overlays/mobile_overlay.dart @@ -26,9 +26,7 @@ class _MobileOverlay extends StatelessWidget { tag: tag, isForward: false, height: double.maxFinite, - onDoubleTap: _isRtl() - ? podCtr.onRightDoubleTap - : podCtr.onLeftDoubleTap, + onDoubleTap: _isRtl() ? podCtr.onRightDoubleTap : podCtr.onLeftDoubleTap, ), ), SizedBox( @@ -42,9 +40,7 @@ class _MobileOverlay extends StatelessWidget { isForward: true, tag: tag, height: double.maxFinite, - onDoubleTap: _isRtl() - ? podCtr.onLeftDoubleTap - : podCtr.onRightDoubleTap, + onDoubleTap: _isRtl() ? podCtr.onLeftDoubleTap : podCtr.onRightDoubleTap, ), ), ], @@ -57,9 +53,7 @@ class _MobileOverlay extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.end, children: [ Expanded( - child: IgnorePointer( - child: podCtr.videoTitle ?? const SizedBox(), - ), + child: podCtr.videoTitle ?? const SizedBox(), ), MaterialIconButton( toolTipMesg: podCtr.podPlayerLabels.settings, diff --git a/lib/src/widgets/core/overlays/web_overlay.dart b/lib/src/widgets/core/overlays/web_overlay.dart index 3371b2fc..251bdf2b 100644 --- a/lib/src/widgets/core/overlays/web_overlay.dart +++ b/lib/src/widgets/core/overlays/web_overlay.dart @@ -61,7 +61,7 @@ class _WebOverlay extends StatelessWidget { }, ), ), - IgnorePointer(child: podCtr.videoTitle ?? const SizedBox()), + podCtr.videoTitle ?? const SizedBox(), ], ); } @@ -107,16 +107,12 @@ class _WebOverlayBottomControlles extends StatelessWidget { id: 'volume', builder: (podCtr) => MaterialIconButton( toolTipMesg: podCtr.isMute - ? podCtr.podPlayerLabels.unmute ?? - 'Unmute${kIsWeb ? ' (m)' : ''}' - : podCtr.podPlayerLabels.mute ?? - 'Mute${kIsWeb ? ' (m)' : ''}', + ? podCtr.podPlayerLabels.unmute ?? 'Unmute${kIsWeb ? ' (m)' : ''}' + : podCtr.podPlayerLabels.mute ?? 'Mute${kIsWeb ? ' (m)' : ''}', color: itemColor, onPressed: podCtr.toggleMute, child: Icon( - podCtr.isMute - ? Icons.volume_off_rounded - : Icons.volume_up_rounded, + podCtr.isMute ? Icons.volume_off_rounded : Icons.volume_up_rounded, ), ), ), @@ -160,16 +156,12 @@ class _WebOverlayBottomControlles extends StatelessWidget { _WebSettingsDropdown(tag: tag), MaterialIconButton( toolTipMesg: podCtr.isFullScreen - ? podCtr.podPlayerLabels.exitFullScreen ?? - 'Exit full screen${kIsWeb ? ' (f)' : ''}' - : podCtr.podPlayerLabels.fullscreen ?? - 'Fullscreen${kIsWeb ? ' (f)' : ''}', + ? podCtr.podPlayerLabels.exitFullScreen ?? 'Exit full screen${kIsWeb ? ' (f)' : ''}' + : podCtr.podPlayerLabels.fullscreen ?? 'Fullscreen${kIsWeb ? ' (f)' : ''}', color: itemColor, onPressed: () => _onFullScreenToggle(podCtr, context), child: Icon( - podCtr.isFullScreen - ? Icons.fullscreen_exit - : Icons.fullscreen, + podCtr.isFullScreen ? Icons.fullscreen_exit : Icons.fullscreen, ), ), ], From 94faa60fa108afa47c04e75cd6c80359c998a620 Mon Sep 17 00:00:00 2001 From: bigzhu Date: Tue, 26 Mar 2024 13:21:04 +0800 Subject: [PATCH 02/20] =?UTF-8?q?=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/pubspec.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 687fec49..bcb72737 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -15,14 +15,14 @@ dependencies: pod_player: path: ../ - cupertino_icons: ^1.0.5 - visibility_detector: ^0.3.3 + cupertino_icons: ^1.0.6 + visibility_detector: ^0.4.0+2 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.1 + flutter_lints: ^2.0.3 flutter: uses-material-design: true From 46c4b8f9552ae301d40dc3508e4e5ee13f8dadfa Mon Sep 17 00:00:00 2001 From: bigzhu Date: Tue, 26 Mar 2024 13:21:15 +0800 Subject: [PATCH 03/20] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E7=9A=84=20theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/widgets/core/overlays/mobile_overlay.dart | 2 +- lib/src/widgets/material_icon_button.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/widgets/core/overlays/mobile_overlay.dart b/lib/src/widgets/core/overlays/mobile_overlay.dart index a1fa0dbd..a7963931 100644 --- a/lib/src/widgets/core/overlays/mobile_overlay.dart +++ b/lib/src/widgets/core/overlays/mobile_overlay.dart @@ -57,7 +57,7 @@ class _MobileOverlay extends StatelessWidget { ), MaterialIconButton( toolTipMesg: podCtr.podPlayerLabels.settings, - color: itemColor, + // color: itemColor, onPressed: () { if (podCtr.isOverlayVisible) { _bottomSheet(context); diff --git a/lib/src/widgets/material_icon_button.dart b/lib/src/widgets/material_icon_button.dart index 6dccb2c1..87d81652 100644 --- a/lib/src/widgets/material_icon_button.dart +++ b/lib/src/widgets/material_icon_button.dart @@ -35,7 +35,7 @@ class MaterialIconButton extends StatelessWidget { child: Padding( padding: EdgeInsets.all(radius), child: IconTheme( - data: IconThemeData(color: color, size: 24), + data: Theme.of(context).iconTheme, child: child, ), ), From a84df307715bbfd73533c92746c23d7833785d2d Mon Sep 17 00:00:00 2001 From: bigzhu Date: Tue, 26 Mar 2024 14:32:22 +0800 Subject: [PATCH 04/20] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=99=BD=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/screens/cutom_video_controllers.dart | 97 ++++++++----------- lib/src/pod_player.dart | 7 +- lib/src/widgets/core/pod_core_player.dart | 23 ++--- lib/src/widgets/double_tap_icon.dart | 14 ++- 4 files changed, 60 insertions(+), 81 deletions(-) diff --git a/example/lib/screens/cutom_video_controllers.dart b/example/lib/screens/cutom_video_controllers.dart index ce511edb..aa7b0d9f 100644 --- a/example/lib/screens/cutom_video_controllers.dart +++ b/example/lib/screens/cutom_video_controllers.dart @@ -15,8 +15,7 @@ class _CustomVideoControllsState extends State { late PodPlayerController controller; bool? isVideoPlaying; final videoTextFieldCtr = TextEditingController( - text: - 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4', + text: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4', ); final vimeoTextFieldCtr = TextEditingController( text: '518228118', @@ -67,22 +66,18 @@ class _CustomVideoControllsState extends State { Widget build(BuildContext context) { /// const sizeH20 = SizedBox(height: 20); - final totalHour = controller.currentVideoPosition.inHours == 0 - ? '0' - : '${controller.currentVideoPosition.inHours}:'; - final totalMinute = - controller.currentVideoPosition.toString().split(':')[1]; - final totalSeconds = (controller.currentVideoPosition - - Duration(minutes: controller.currentVideoPosition.inMinutes)) - .inSeconds - .toString() - .padLeft(2, '0'); + final totalHour = + controller.currentVideoPosition.inHours == 0 ? '0' : '${controller.currentVideoPosition.inHours}:'; + final totalMinute = controller.currentVideoPosition.toString().split(':')[1]; + final totalSeconds = + (controller.currentVideoPosition - Duration(minutes: controller.currentVideoPosition.inMinutes)) + .inSeconds + .toString() + .padLeft(2, '0'); /// const videoTitle = Padding( - padding: kIsWeb - ? EdgeInsets.symmetric(vertical: 25, horizontal: 15) - : EdgeInsets.only(left: 15), + padding: kIsWeb ? EdgeInsets.symmetric(vertical: 25, horizontal: 15) : EdgeInsets.only(left: 15), child: Text( 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.', style: TextStyle( @@ -149,46 +144,37 @@ class _CustomVideoControllsState extends State { sizeH20, _loadVideoFromYoutube(), sizeH20, - _iconButton('Hide progress bar on overlay hidden', - Icons.hide_source, onPressed: () { + _iconButton('Hide progress bar on overlay hidden', Icons.hide_source, onPressed: () { setState(() { alwaysShowProgressBar = false; }); }), sizeH20, - _iconButton('Show Overlay', Icons.slideshow_outlined, - onPressed: () { + _iconButton('Show Overlay', Icons.slideshow_outlined, onPressed: () { controller.showOverlay(); }), sizeH20, - _iconButton('Hide Overlay', Icons.hide_image, - onPressed: () { + _iconButton('Hide Overlay', Icons.hide_image, onPressed: () { controller.hideOverlay(); }), - _iconButton('Backward video 5s', Icons.replay_5_rounded, - onPressed: () { + _iconButton('Backward video 5s', Icons.replay_5_rounded, onPressed: () { controller.doubleTapVideoBackward(5); }), sizeH20, - _iconButton('Forward video 5s', Icons.forward_5_rounded, - onPressed: () { + _iconButton('Forward video 5s', Icons.forward_5_rounded, onPressed: () { controller.doubleTapVideoForward(5); }), sizeH20, - _iconButton('Video Jump to 01:00 minute', - Icons.fast_forward_rounded, onPressed: () { + _iconButton('Video Jump to 01:00 minute', Icons.fast_forward_rounded, onPressed: () { controller.videoSeekTo(const Duration(minutes: 1)); }), sizeH20, - _iconButton('Enable full screen', Icons.fullscreen, - onPressed: () { + _iconButton('Enable full screen', Icons.fullscreen, onPressed: () { controller.enableFullScreen(); }), sizeH20, - _iconButton( - controller.isMute ? 'UnMute video' : 'mute video', - controller.isMute ? Icons.volume_up : Icons.volume_off, - onPressed: () { + _iconButton(controller.isMute ? 'UnMute video' : 'mute video', + controller.isMute ? Icons.volume_up : Icons.volume_off, onPressed: () { controller.toggleVolume(); }), sizeH20, @@ -213,21 +199,24 @@ class _CustomVideoControllsState extends State { ), ), ), - floatingActionButton: FloatingActionButton( - backgroundColor: Colors.black, - onPressed: () => controller.togglePlayPause(), - child: isVideoPlaying == null - ? const SizedBox( - height: 20, - width: 20, - child: CircularProgressIndicator( - backgroundColor: Colors.black, - color: Colors.white, - strokeWidth: 1, - ), - ) - : Icon(!isVideoPlaying! ? Icons.play_arrow : Icons.pause), - ), + // floatingActionButton: FloatingActionButton( + // backgroundColor: Colors.black, + // onPressed: () => controller.togglePlayPause(), + // child: isVideoPlaying == null + // ? SizedBox( + // height: 20, + // width: 20, + // child: CircularProgressIndicator( + // backgroundColor: Colors.black, + // color: Theme.of(context).primaryColor, + // strokeWidth: 1, + // ), + // ) + // : Icon( + // !isVideoPlaying! ? Icons.play_arrow : Icons.pause, + // color: Theme.of(context).primaryColor, + // ), + // ), ); } @@ -267,8 +256,7 @@ class _CustomVideoControllsState extends State { if (!mounted) return; ScaffoldMessenger.of(context).hideCurrentSnackBar(); } catch (e) { - snackBar( - "Unable to load,${kIsWeb ? 'Please enable CORS in web' : ''} \n$e"); + snackBar("Unable to load,${kIsWeb ? 'Please enable CORS in web' : ''} \n$e"); } }, child: const Text('Load Video'), @@ -313,8 +301,7 @@ class _CustomVideoControllsState extends State { if (!mounted) return; ScaffoldMessenger.of(context).hideCurrentSnackBar(); } catch (e) { - snackBar( - "Unable to load,${kIsWeb ? 'Please enable CORS in web' : ''} \n$e"); + snackBar("Unable to load,${kIsWeb ? 'Please enable CORS in web' : ''} \n$e"); } }, child: const Text('Load Video'), @@ -372,12 +359,10 @@ class _CustomVideoControllsState extends State { ); } - ElevatedButton _iconButton(String text, IconData icon, - {void Function()? onPressed}) { + ElevatedButton _iconButton(String text, IconData icon, {void Function()? onPressed}) { return ElevatedButton.icon( onPressed: onPressed ?? () {}, - style: ElevatedButton.styleFrom( - fixedSize: const Size.fromWidth(double.maxFinite)), + style: ElevatedButton.styleFrom(fixedSize: const Size.fromWidth(double.maxFinite)), icon: Icon(icon), label: Text(text)); } diff --git a/lib/src/pod_player.dart b/lib/src/pod_player.dart index 82f451f8..28407c5a 100644 --- a/lib/src/pod_player.dart +++ b/lib/src/pod_player.dart @@ -97,8 +97,7 @@ class PodVideoPlayer extends StatefulWidget { State createState() => _PodVideoPlayerState(); } -class _PodVideoPlayerState extends State - with TickerProviderStateMixin { +class _PodVideoPlayerState extends State with TickerProviderStateMixin { late PodGetXVideoController _podCtr; // late String tag; @@ -212,9 +211,9 @@ class _PodVideoPlayerState extends State Widget _buildLoading() { return widget.onLoading?.call(context) ?? - const CircularProgressIndicator( + CircularProgressIndicator( backgroundColor: Colors.black87, - color: Colors.white, + color: Theme.of(context).primaryColor, strokeWidth: 2, ); } diff --git a/lib/src/widgets/core/pod_core_player.dart b/lib/src/widgets/core/pod_core_player.dart index 7a7a3e47..b6cbece1 100644 --- a/lib/src/widgets/core/pod_core_player.dart +++ b/lib/src/widgets/core/pod_core_player.dart @@ -18,9 +18,7 @@ class _PodCoreVideoPlayer extends StatelessWidget { builder: (ctrx) { return RawKeyboardListener( autofocus: true, - focusNode: - (podCtr.isFullScreen ? FocusNode() : podCtr.keyboardFocusWeb) ?? - FocusNode(), + focusNode: (podCtr.isFullScreen ? FocusNode() : podCtr.keyboardFocusWeb) ?? FocusNode(), onKey: (value) => podCtr.onKeyBoardEvents( event: value, appContext: ctrx, @@ -46,8 +44,7 @@ class _PodCoreVideoPlayer extends StatelessWidget { return const SizedBox(); } - if (podCtr.podVideoState == PodVideoState.paused && - podCtr.videoPosition == Duration.zero) { + if (podCtr.podVideoState == PodVideoState.paused && podCtr.videoPosition == Duration.zero) { return SizedBox.expand( child: TweenAnimationBuilder( builder: (context, value, child) => Opacity( @@ -88,11 +85,12 @@ class _PodCoreVideoPlayer extends StatelessWidget { case PodVideoState.loading: return loadingWidget; case PodVideoState.paused: - return const Center( + return Center( child: Icon( Icons.play_arrow, size: 45, - color: Colors.white, + color: Theme.of(context).iconTheme.color, + // color: Colors.white, ), ); case PodVideoState.playing: @@ -104,10 +102,11 @@ class _PodCoreVideoPlayer extends StatelessWidget { ), tween: Tween(begin: 1, end: 0), duration: const Duration(seconds: 1), - child: const Icon( + child: Icon( Icons.pause, size: 45, - color: Colors.white, + color: Theme.of(context).iconTheme.color, + // color: Colors.white, ), ), ); @@ -132,16 +131,14 @@ class _PodCoreVideoPlayer extends StatelessWidget { : GetBuilder( tag: tag, id: 'overlay', - builder: (podCtr) => podCtr.isOverlayVisible || - !podCtr.alwaysShowProgressBar + builder: (podCtr) => podCtr.isOverlayVisible || !podCtr.alwaysShowProgressBar ? const SizedBox() : Align( alignment: Alignment.bottomCenter, child: PodProgressBar( tag: tag, alignment: Alignment.bottomCenter, - podProgressBarConfig: - podCtr.podProgressBarConfig, + podProgressBarConfig: podCtr.podProgressBarConfig, ), ), ), diff --git a/lib/src/widgets/double_tap_icon.dart b/lib/src/widgets/double_tap_icon.dart index 1875e920..b58a0fd9 100644 --- a/lib/src/widgets/double_tap_icon.dart +++ b/lib/src/widgets/double_tap_icon.dart @@ -26,8 +26,7 @@ class DoubleTapIcon extends StatefulWidget { State createState() => _DoubleTapIconState(); } -class _DoubleTapIconState extends State - with SingleTickerProviderStateMixin { +class _DoubleTapIconState extends State with SingleTickerProviderStateMixin { late final AnimationController _animationController; late final Animation opacityCtr; @@ -81,10 +80,8 @@ class _DoubleTapIconState extends State onDoubleTap: _onDoubleTap, rippleColor: Colors.white, wrapper: (parentWidget, curveRadius) { - final forwardRadius = - !widget.isForward ? Radius.zero : Radius.circular(curveRadius); - final backwardRadius = - widget.isForward ? Radius.zero : Radius.circular(curveRadius); + final forwardRadius = !widget.isForward ? Radius.zero : Radius.circular(curveRadius); + final backwardRadius = widget.isForward ? Radius.zero : Radius.circular(curveRadius); return ClipRRect( borderRadius: BorderRadius.only( bottomLeft: forwardRadius, @@ -106,10 +103,11 @@ class _DoubleTapIconState extends State child: AnimatedBuilder( animation: _animationController, builder: (context, child) { - const icon = Icon( + final icon = Icon( Icons.play_arrow_sharp, size: 32, - color: Colors.white, + // color: Colors.white, + color: Theme.of(context).iconTheme.color, ); return Center( child: Column( From b5d184ed4d2dc830df8c9d441b46bdd6c8c604af Mon Sep 17 00:00:00 2001 From: bigzhu Date: Tue, 26 Mar 2024 14:50:23 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E7=9A=84=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/screens/cutom_video_controllers.dart | 36 +++++++++---------- lib/src/widgets/animated_play_pause_icon.dart | 15 ++++---- .../widgets/core/overlays/mobile_overlay.dart | 2 -- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/example/lib/screens/cutom_video_controllers.dart b/example/lib/screens/cutom_video_controllers.dart index aa7b0d9f..24293a29 100644 --- a/example/lib/screens/cutom_video_controllers.dart +++ b/example/lib/screens/cutom_video_controllers.dart @@ -199,24 +199,24 @@ class _CustomVideoControllsState extends State { ), ), ), - // floatingActionButton: FloatingActionButton( - // backgroundColor: Colors.black, - // onPressed: () => controller.togglePlayPause(), - // child: isVideoPlaying == null - // ? SizedBox( - // height: 20, - // width: 20, - // child: CircularProgressIndicator( - // backgroundColor: Colors.black, - // color: Theme.of(context).primaryColor, - // strokeWidth: 1, - // ), - // ) - // : Icon( - // !isVideoPlaying! ? Icons.play_arrow : Icons.pause, - // color: Theme.of(context).primaryColor, - // ), - // ), + floatingActionButton: FloatingActionButton( + backgroundColor: Colors.black, + onPressed: () => controller.togglePlayPause(), + child: isVideoPlaying == null + ? SizedBox( + height: 20, + width: 20, + child: CircularProgressIndicator( + backgroundColor: Colors.black, + color: Theme.of(context).primaryColor, + strokeWidth: 1, + ), + ) + : Icon( + !isVideoPlaying! ? Icons.play_arrow : Icons.pause, + color: Theme.of(context).primaryColor, + ), + ), ); } diff --git a/lib/src/widgets/animated_play_pause_icon.dart b/lib/src/widgets/animated_play_pause_icon.dart index 0aabdd3a..674d5b34 100644 --- a/lib/src/widgets/animated_play_pause_icon.dart +++ b/lib/src/widgets/animated_play_pause_icon.dart @@ -13,8 +13,7 @@ class _AnimatedPlayPauseIcon extends StatefulWidget { State<_AnimatedPlayPauseIcon> createState() => _AnimatedPlayPauseIconState(); } -class _AnimatedPlayPauseIconState extends State<_AnimatedPlayPauseIcon> - with SingleTickerProviderStateMixin { +class _AnimatedPlayPauseIconState extends State<_AnimatedPlayPauseIcon> with SingleTickerProviderStateMixin { late final AnimationController _payCtr; late PodGetXVideoController _podCtr; @override @@ -60,12 +59,9 @@ class _AnimatedPlayPauseIconState extends State<_AnimatedPlayPauseIcon> id: 'podVideoState', builder: (f) => MaterialIconButton( toolTipMesg: f.isvideoPlaying - ? podCtr.podPlayerLabels.pause ?? - 'Pause${kIsWeb ? ' (space)' : ''}' - : podCtr.podPlayerLabels.play ?? - 'Play${kIsWeb ? ' (space)' : ''}', - onPressed: - podCtr.isOverlayVisible ? podCtr.togglePlayPauseVideo : null, + ? podCtr.podPlayerLabels.pause ?? 'Pause${kIsWeb ? ' (space)' : ''}' + : podCtr.podPlayerLabels.play ?? 'Play${kIsWeb ? ' (space)' : ''}', + onPressed: podCtr.isOverlayVisible ? podCtr.togglePlayPauseVideo : null, child: onStateChange(podCtr), ), ); @@ -86,7 +82,8 @@ class _AnimatedPlayPauseIconState extends State<_AnimatedPlayPauseIcon> return AnimatedIcon( icon: AnimatedIcons.play_pause, progress: _payCtr, - color: Colors.white, + // 操作按钮的颜色 + color: Theme.of(context).primaryColor, size: widget.size, ); } diff --git a/lib/src/widgets/core/overlays/mobile_overlay.dart b/lib/src/widgets/core/overlays/mobile_overlay.dart index a7963931..6bde152e 100644 --- a/lib/src/widgets/core/overlays/mobile_overlay.dart +++ b/lib/src/widgets/core/overlays/mobile_overlay.dart @@ -10,7 +10,6 @@ class _MobileOverlay extends StatelessWidget { @override Widget build(BuildContext context) { const overlayColor = Colors.black38; - const itemColor = Colors.white; final podCtr = Get.find(tag: tag); return Stack( alignment: Alignment.center, @@ -57,7 +56,6 @@ class _MobileOverlay extends StatelessWidget { ), MaterialIconButton( toolTipMesg: podCtr.podPlayerLabels.settings, - // color: itemColor, onPressed: () { if (podCtr.isOverlayVisible) { _bottomSheet(context); From edc6643812d54940a75569037395adc9f610dc02 Mon Sep 17 00:00:00 2001 From: bigzhu Date: Tue, 26 Mar 2024 14:58:53 +0800 Subject: [PATCH 06/20] =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=9A=84=E9=A2=9C?= =?UTF-8?q?=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/overlays/mobile_bottomsheet.dart | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/src/widgets/core/overlays/mobile_bottomsheet.dart b/lib/src/widgets/core/overlays/mobile_bottomsheet.dart index 5cf988e9..65497442 100644 --- a/lib/src/widgets/core/overlays/mobile_bottomsheet.dart +++ b/lib/src/widgets/core/overlays/mobile_bottomsheet.dart @@ -40,9 +40,7 @@ class _MobileBottomSheet extends StatelessWidget { _bottomSheetTiles( title: podCtr.podPlayerLabels.loopVideo, icon: Icons.loop_rounded, - subText: podCtr.isLooping - ? podCtr.podPlayerLabels.optionEnabled - : podCtr.podPlayerLabels.optionDisabled, + subText: podCtr.isLooping ? podCtr.podPlayerLabels.optionEnabled : podCtr.podPlayerLabels.optionDisabled, onTap: () { Navigator.of(context).pop(); podCtr.toggleLooping(); @@ -187,8 +185,8 @@ class _MobileOverlayBottomControlles extends StatelessWidget { @override Widget build(BuildContext context) { - const durationTextStyle = TextStyle(color: Colors.white70); - const itemColor = Colors.white; + final itemColor = Theme.of(context).primaryColor; + final durationTextStyle = TextStyle(color: itemColor); return GetBuilder( tag: tag, @@ -207,9 +205,9 @@ class _MobileOverlayBottomControlles extends StatelessWidget { children: [ Text( podCtr.calculateVideoDuration(podCtr.videoPosition), - style: const TextStyle(color: itemColor), + style: TextStyle(color: itemColor), ), - const Text( + Text( ' / ', style: durationTextStyle, ), @@ -224,10 +222,8 @@ class _MobileOverlayBottomControlles extends StatelessWidget { const Spacer(), MaterialIconButton( toolTipMesg: podCtr.isFullScreen - ? podCtr.podPlayerLabels.exitFullScreen ?? - 'Exit full screen${kIsWeb ? ' (f)' : ''}' - : podCtr.podPlayerLabels.fullscreen ?? - 'Fullscreen${kIsWeb ? ' (f)' : ''}', + ? podCtr.podPlayerLabels.exitFullScreen ?? 'Exit full screen${kIsWeb ? ' (f)' : ''}' + : podCtr.podPlayerLabels.fullscreen ?? 'Fullscreen${kIsWeb ? ' (f)' : ''}', color: itemColor, onPressed: () { if (podCtr.isOverlayVisible) { @@ -241,9 +237,7 @@ class _MobileOverlayBottomControlles extends StatelessWidget { } }, child: Icon( - podCtr.isFullScreen - ? Icons.fullscreen_exit - : Icons.fullscreen, + podCtr.isFullScreen ? Icons.fullscreen_exit : Icons.fullscreen, ), ), ], From 67ce4d26606b8abfe181d0c4d5613cad5ff88e4b Mon Sep 17 00:00:00 2001 From: bigzhu Date: Tue, 26 Mar 2024 15:07:52 +0800 Subject: [PATCH 07/20] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=94=A8=E4=B8=BB?= =?UTF-8?q?=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/lib/screens/cutom_video_controllers.dart | 4 ++-- lib/src/pod_player.dart | 2 +- lib/src/widgets/animated_play_pause_icon.dart | 2 +- lib/src/widgets/core/overlays/mobile_bottomsheet.dart | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/example/lib/screens/cutom_video_controllers.dart b/example/lib/screens/cutom_video_controllers.dart index 24293a29..db1bc89a 100644 --- a/example/lib/screens/cutom_video_controllers.dart +++ b/example/lib/screens/cutom_video_controllers.dart @@ -208,13 +208,13 @@ class _CustomVideoControllsState extends State { width: 20, child: CircularProgressIndicator( backgroundColor: Colors.black, - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, strokeWidth: 1, ), ) : Icon( !isVideoPlaying! ? Icons.play_arrow : Icons.pause, - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, ), ), ); diff --git a/lib/src/pod_player.dart b/lib/src/pod_player.dart index 28407c5a..59baa9dd 100644 --- a/lib/src/pod_player.dart +++ b/lib/src/pod_player.dart @@ -213,7 +213,7 @@ class _PodVideoPlayerState extends State with TickerProviderStat return widget.onLoading?.call(context) ?? CircularProgressIndicator( backgroundColor: Colors.black87, - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, strokeWidth: 2, ); } diff --git a/lib/src/widgets/animated_play_pause_icon.dart b/lib/src/widgets/animated_play_pause_icon.dart index 674d5b34..91fa6d1d 100644 --- a/lib/src/widgets/animated_play_pause_icon.dart +++ b/lib/src/widgets/animated_play_pause_icon.dart @@ -83,7 +83,7 @@ class _AnimatedPlayPauseIconState extends State<_AnimatedPlayPauseIcon> with Sin icon: AnimatedIcons.play_pause, progress: _payCtr, // 操作按钮的颜色 - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, size: widget.size, ); } diff --git a/lib/src/widgets/core/overlays/mobile_bottomsheet.dart b/lib/src/widgets/core/overlays/mobile_bottomsheet.dart index 65497442..a6c95816 100644 --- a/lib/src/widgets/core/overlays/mobile_bottomsheet.dart +++ b/lib/src/widgets/core/overlays/mobile_bottomsheet.dart @@ -185,7 +185,7 @@ class _MobileOverlayBottomControlles extends StatelessWidget { @override Widget build(BuildContext context) { - final itemColor = Theme.of(context).primaryColor; + final itemColor = Theme.of(context).colorScheme.primary; final durationTextStyle = TextStyle(color: itemColor); return GetBuilder( From 432802683e26c87ffe7cd88eb301777ace92a11b Mon Sep 17 00:00:00 2001 From: bigzhu Date: Mon, 22 Apr 2024 14:07:58 +0800 Subject: [PATCH 08/20] update --- example/lib/screens/from_youtube.dart | 1 + example/pubspec.yaml | 4 ++-- pubspec.yaml | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/example/lib/screens/from_youtube.dart b/example/lib/screens/from_youtube.dart index 8c10ec69..a97f3e06 100644 --- a/example/lib/screens/from_youtube.dart +++ b/example/lib/screens/from_youtube.dart @@ -39,6 +39,7 @@ class _PlayVideoFromVimeoIdState extends State { shrinkWrap: true, children: [ PodVideoPlayer( + podProgressBarConfig: PodProgressBarConfig(), controller: controller, videoThumbnail: const DecorationImage( image: NetworkImage( diff --git a/example/pubspec.yaml b/example/pubspec.yaml index bcb72737..5efd8fd8 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -15,14 +15,14 @@ dependencies: pod_player: path: ../ - cupertino_icons: ^1.0.6 + cupertino_icons: ^1.0.8 visibility_detector: ^0.4.0+2 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.3 + flutter_lints: ^3.0.2 flutter: uses-material-design: true diff --git a/pubspec.yaml b/pubspec.yaml index 88647f4e..7832da91 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,17 +11,17 @@ dependencies: flutter: sdk: flutter # services - video_player: ^2.7.0 - http: ^1.1.0 - get: ^4.6.5 - wakelock_plus: ^1.1.1 - universal_html: ^2.2.3 - youtube_explode_dart: ^2.0.1 + video_player: ^2.8.6 + http: ^1.2.1 + get: ^4.6.6 + wakelock_plus: ^1.2.4 + universal_html: ^2.2.4 + youtube_explode_dart: ^2.2.0 dev_dependencies: flutter_test: sdk: flutter - very_good_analysis: ^5.0.0+1 + very_good_analysis: ^5.1.0 screenshots: - description: Pod video player logo From 3962e0dedc52115beec87f19a0b58d9747532b38 Mon Sep 17 00:00:00 2001 From: bigzhu Date: Wed, 15 May 2024 14:14:13 +0800 Subject: [PATCH 09/20] remove version --- example/pubspec.yaml | 11 ++++++----- pubspec.yaml | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 5efd8fd8..261d1196 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -15,17 +15,18 @@ dependencies: pod_player: path: ../ - cupertino_icons: ^1.0.8 - visibility_detector: ^0.4.0+2 + cupertino_icons: + visibility_detector: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.2 + flutter_lints: flutter: uses-material-design: true - + assets: - - assets/ \ No newline at end of file + - assets/ + diff --git a/pubspec.yaml b/pubspec.yaml index 6376b9b1..4151f064 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,12 +11,12 @@ dependencies: flutter: sdk: flutter # services - video_player: ^2.8.6 - http: ^1.2.1 - get: ^4.6.6 - wakelock_plus: ^1.2.4 - universal_html: ^2.2.4 - youtube_explode_dart: ^2.2.0 + video_player: + http: + get: + wakelock_plus: + universal_html: + youtube_explode_dart: dev_dependencies: flutter_test: From e6b6abc356e2285cfc7415b131643c70aa6a6836 Mon Sep 17 00:00:00 2001 From: bigzhu Date: Sun, 7 Jul 2024 22:54:05 +0800 Subject: [PATCH 10/20] =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/controllers/pod_getx_video_controller.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/controllers/pod_getx_video_controller.dart b/lib/src/controllers/pod_getx_video_controller.dart index 7a46d30d..98a6e5f4 100644 --- a/lib/src/controllers/pod_getx_video_controller.dart +++ b/lib/src/controllers/pod_getx_video_controller.dart @@ -69,8 +69,7 @@ class PodGetXVideoController extends _PodGesturesController { update(['update-all']); // ignore: unawaited_futures - Future.delayed(const Duration(milliseconds: 600)) - .then((_) => _isWebAutoPlayDone = true); + Future.delayed(const Duration(milliseconds: 600)).then((_) => _isWebAutoPlayDone = true); } catch (e) { podVideoStateChanger(PodVideoState.error); update(['errorState']); @@ -223,8 +222,7 @@ class PodGetXVideoController extends _PodGesturesController { onRightDoubleTap(); return; } - if (event.isKeyPressed(LogicalKeyboardKey.keyF) && - event.logicalKey.keyLabel == 'F') { + if (event.isKeyPressed(LogicalKeyboardKey.keyF) && event.logicalKey.keyLabel == 'F') { toggleFullScreenOnWeb(appContext, tag); } if (event.isKeyPressed(LogicalKeyboardKey.escape)) { @@ -277,7 +275,9 @@ class PodGetXVideoController extends _PodGesturesController { ///checkes wether video should be `autoplayed` initially void checkAutoPlayVideo() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) async { - if (autoPlay && (isVideoUiBinded ?? false)) { + // 一些奇怪的图片资源加载异常, 都会导致 isVideoUiBinded 不成功, 这里不再检查, 直接自动播放 + // if (autoPlay && (isVideoUiBinded ?? false)) { + if (autoPlay) { if (kIsWeb) await _videoCtr?.setVolume(0); podVideoStateChanger(PodVideoState.playing); } else { From 97ee1a2cd6cab42c57caf3072164720bf0ac3dc3 Mon Sep 17 00:00:00 2001 From: bigzhu Date: Thu, 11 Jul 2024 12:37:09 +0800 Subject: [PATCH 11/20] =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=89=8D=E5=80=BC,=20?= =?UTF-8?q?=E4=BC=9A=E5=AF=BC=E8=87=B4=20player=20=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E5=90=8E=E6=97=A0=E6=B3=95=E5=86=8D=E6=8E=A7=E5=88=B6=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E5=92=8C=E6=9A=82=E5=81=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/controllers/pod_base_controller.dart | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/src/controllers/pod_base_controller.dart b/lib/src/controllers/pod_base_controller.dart index 4edc604c..28e17532 100644 --- a/lib/src/controllers/pod_base_controller.dart +++ b/lib/src/controllers/pod_base_controller.dart @@ -81,13 +81,15 @@ class _PodBaseController extends GetxController { ///updates state with id `_podVideoState` void podVideoStateChanger(PodVideoState? val, {bool updateUi = true}) { - if (_podVideoState != (val ?? _podVideoState)) { - _podVideoState = val ?? _podVideoState; - if (updateUi) { - update(['podVideoState']); - update(['update-all']); - } + // 判断前值, 会导致 player 隐藏后无法再控制播放和暂停 + // if (_podVideoState != (val ?? _podVideoState)) { + _podVideoState = val ?? _podVideoState; + if (updateUi) { + // print("podVideoStateChanger val=$val _podVideoState=$_podVideoState"); + update(['podVideoState']); + update(['update-all']); } + // } } void _listneToVideoPosition() { @@ -96,8 +98,7 @@ class _PodBaseController extends GetxController { update(['video-progress']); update(['update-all']); } else { - if (_videoPosition.inSeconds != - (_videoCtr?.value.position ?? Duration.zero).inSeconds) { + if (_videoPosition.inSeconds != (_videoCtr?.value.position ?? Duration.zero).inSeconds) { _videoPosition = _videoCtr?.value.position ?? Duration.zero; update(['video-progress']); update(['update-all']); From 0aeb36450bfba4d312b783da5c4b751b7130383b Mon Sep 17 00:00:00 2001 From: bigzhu Date: Wed, 14 Aug 2024 21:54:34 +0800 Subject: [PATCH 12/20] upgrade --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 4151f064..13d9ad96 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,7 +21,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - very_good_analysis: ^5.1.0 + very_good_analysis: screenshots: - description: Pod video player logo From 4b7aa28b362ffaecebbcdbe2824e94d811f7acb0 Mon Sep 17 00:00:00 2001 From: bigzhu Date: Thu, 5 Sep 2024 18:30:12 +0800 Subject: [PATCH 13/20] update --- analysis_options.yaml | 3 ++- example/lib/screens/from_youtube.dart | 2 +- lib/src/controllers/pod_getx_video_controller.dart | 12 ++++-------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 18aea978..3eeb57ec 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,10 +1,11 @@ include: package:very_good_analysis/analysis_options.yaml analyzer: + exclude: + - "**" errors: missing_required_param: error prefer_const_declarations: warning prefer_const_constructors: warning - import_of_legacy_library_into_null_safe: warning public_member_api_docs: ignore language: strict-casts: true diff --git a/example/lib/screens/from_youtube.dart b/example/lib/screens/from_youtube.dart index a97f3e06..98df9b66 100644 --- a/example/lib/screens/from_youtube.dart +++ b/example/lib/screens/from_youtube.dart @@ -39,7 +39,7 @@ class _PlayVideoFromVimeoIdState extends State { shrinkWrap: true, children: [ PodVideoPlayer( - podProgressBarConfig: PodProgressBarConfig(), + podProgressBarConfig: const PodProgressBarConfig(), controller: controller, videoThumbnail: const DecorationImage( image: NetworkImage( diff --git a/lib/src/controllers/pod_getx_video_controller.dart b/lib/src/controllers/pod_getx_video_controller.dart index 98a6e5f4..769e0deb 100644 --- a/lib/src/controllers/pod_getx_video_controller.dart +++ b/lib/src/controllers/pod_getx_video_controller.dart @@ -69,7 +69,8 @@ class PodGetXVideoController extends _PodGesturesController { update(['update-all']); // ignore: unawaited_futures - Future.delayed(const Duration(milliseconds: 600)).then((_) => _isWebAutoPlayDone = true); + Future.delayed(const Duration(milliseconds: 600)) + .then((_) => _isWebAutoPlayDone = true); } catch (e) { podVideoStateChanger(PodVideoState.error); update(['errorState']); @@ -92,7 +93,6 @@ class PodGetXVideoController extends _PodGesturesController { httpHeaders: playVideoFrom.httpHeaders, ); playingVideoUrl = playVideoFrom.dataSource; - break; case PodVideoPlayerType.networkQualityUrls: final url = await getUrlFromVideoQualityUrls( qualityList: podPlayerConfig.videoQualityPriority, @@ -109,7 +109,6 @@ class PodGetXVideoController extends _PodGesturesController { ); playingVideoUrl = url; - break; case PodVideoPlayerType.youtube: final urls = await getVideoQualityUrlsFromYoutube( playVideoFrom.dataSource!, @@ -130,7 +129,6 @@ class PodGetXVideoController extends _PodGesturesController { ); playingVideoUrl = url; - break; case PodVideoPlayerType.vimeo: await getQualityUrlsFromVimeoId( playVideoFrom.dataSource!, @@ -150,7 +148,6 @@ class PodGetXVideoController extends _PodGesturesController { ); playingVideoUrl = url; - break; case PodVideoPlayerType.asset: /// @@ -162,7 +159,6 @@ class PodGetXVideoController extends _PodGesturesController { ); playingVideoUrl = playVideoFrom.dataSource; - break; case PodVideoPlayerType.file: if (kIsWeb) { throw Exception('file doesnt support web'); @@ -175,7 +171,6 @@ class PodGetXVideoController extends _PodGesturesController { videoPlayerOptions: playVideoFrom.videoPlayerOptions, ); - break; case PodVideoPlayerType.vimeoPrivateVideos: await getQualityUrlsFromVimeoPrivateId( playVideoFrom.dataSource!, @@ -222,7 +217,8 @@ class PodGetXVideoController extends _PodGesturesController { onRightDoubleTap(); return; } - if (event.isKeyPressed(LogicalKeyboardKey.keyF) && event.logicalKey.keyLabel == 'F') { + if (event.isKeyPressed(LogicalKeyboardKey.keyF) && + event.logicalKey.keyLabel == 'F') { toggleFullScreenOnWeb(appContext, tag); } if (event.isKeyPressed(LogicalKeyboardKey.escape)) { From ec67f7119ab2145da9034ec6fcb0d44bb7493db8 Mon Sep 17 00:00:00 2001 From: bigzhu Date: Mon, 30 Sep 2024 22:29:29 +0800 Subject: [PATCH 14/20] use local explode --- pubspec.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/pubspec.yaml b/pubspec.yaml index 13d9ad96..a7d069a0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,6 +17,7 @@ dependencies: wakelock_plus: universal_html: youtube_explode_dart: + path: ../youtube_explode_dart/ dev_dependencies: flutter_test: From 584da902a7368956b7aad062aafa12a7ad75183e Mon Sep 17 00:00:00 2001 From: bigzhu Date: Fri, 8 Nov 2024 11:37:41 +0800 Subject: [PATCH 15/20] upgrade --- pubspec.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index a7d069a0..0924ea59 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,18 +11,18 @@ dependencies: flutter: sdk: flutter # services - video_player: - http: - get: - wakelock_plus: - universal_html: + video_player: 2.9.2 + http: 1.2.2 + get: 4.6.6 + wakelock_plus: 1.2.8 + universal_html: 2.2.4 youtube_explode_dart: path: ../youtube_explode_dart/ dev_dependencies: flutter_test: sdk: flutter - very_good_analysis: + very_good_analysis: 6.0.0 screenshots: - description: Pod video player logo From da2d5a83e426724b2872ab2ee3dba6907cf7689a Mon Sep 17 00:00:00 2001 From: bigzhu Date: Sun, 23 Mar 2025 12:24:04 +0800 Subject: [PATCH 16/20] update --- pubspec.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 0924ea59..943ae834 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,9 +12,9 @@ dependencies: sdk: flutter # services video_player: 2.9.2 - http: 1.2.2 - get: 4.6.6 - wakelock_plus: 1.2.8 + http: 1.3.0 + get: 4.7.2 + wakelock_plus: 1.2.10 universal_html: 2.2.4 youtube_explode_dart: path: ../youtube_explode_dart/ @@ -22,7 +22,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - very_good_analysis: 6.0.0 + very_good_analysis: 7.0.0 screenshots: - description: Pod video player logo From 2648c0ec03208e1eb4e96bbfe6739c2a6f05b691 Mon Sep 17 00:00:00 2001 From: bigzhu Date: Tue, 25 Mar 2025 07:59:22 +0800 Subject: [PATCH 17/20] set source --- lib/src/utils/video_apis.dart | 10 +++++++++- pubspec.yaml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/src/utils/video_apis.dart b/lib/src/utils/video_apis.dart index 69153a19..b8ca98a8 100644 --- a/lib/src/utils/video_apis.dart +++ b/lib/src/utils/video_apis.dart @@ -139,7 +139,14 @@ class VideoApis { ); } else { final manifest = - await yt.videos.streamsClient.getManifest(youtubeIdOrUrl); + await yt.videos.streamsClient.getManifest(youtubeIdOrUrl, + // 限定只使用 safari 来获取视频链接 + ytClients: [ + YoutubeApiClient.safari, + // YoutubeApiClient.androidVr, + // YoutubeApiClient.ios, + ] + ); urls.addAll( manifest.muxed.map( (element) => VideoQalityUrls( @@ -148,6 +155,7 @@ class VideoApis { ), ), ); + print('urls: $urls'); } // Close the YoutubeExplode's http client. yt.close(); diff --git a/pubspec.yaml b/pubspec.yaml index 943ae834..4a83d070 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: flutter: sdk: flutter # services - video_player: 2.9.2 + video_player: 2.9.3 http: 1.3.0 get: 4.7.2 wakelock_plus: 1.2.10 From 5f04e2b4b8cb809335ab37dce6a2a9fc7d10cb3c Mon Sep 17 00:00:00 2001 From: bigzhu Date: Wed, 26 Mar 2025 11:34:03 +0800 Subject: [PATCH 18/20] fix --- lib/src/utils/video_apis.dart | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/src/utils/video_apis.dart b/lib/src/utils/video_apis.dart index b8ca98a8..12b81eb5 100644 --- a/lib/src/utils/video_apis.dart +++ b/lib/src/utils/video_apis.dart @@ -139,16 +139,10 @@ class VideoApis { ); } else { final manifest = - await yt.videos.streamsClient.getManifest(youtubeIdOrUrl, - // 限定只使用 safari 来获取视频链接 - ytClients: [ - YoutubeApiClient.safari, - // YoutubeApiClient.androidVr, - // YoutubeApiClient.ios, - ] - ); + await yt.videos.streamsClient.getManifest(youtubeIdOrUrl); + final bestQuality = manifest.muxed.bestQuality; urls.addAll( - manifest.muxed.map( + [bestQuality].map( (element) => VideoQalityUrls( quality: int.parse(element.qualityLabel.split('p')[0]), url: element.url.toString(), From d6d5a02a941d8941a9d0fdf01982d657e6717264 Mon Sep 17 00:00:00 2001 From: bigzhu Date: Thu, 8 May 2025 10:16:37 +0800 Subject: [PATCH 19/20] upgrade --- example/macos/Podfile | 2 +- example/macos/Podfile.lock | 35 +++------ .../macos/Runner.xcodeproj/project.pbxproj | 73 +++++++++++++++++-- .../xcshareddata/xcschemes/Runner.xcscheme | 3 +- .../contents.xcworkspacedata | 3 + example/macos/Runner/AppDelegate.swift | 6 +- pubspec.yaml | 4 +- 7 files changed, 89 insertions(+), 37 deletions(-) diff --git a/example/macos/Podfile b/example/macos/Podfile index dade8dfa..049abe29 100644 --- a/example/macos/Podfile +++ b/example/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.11' +platform :osx, '10.14' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 5bfc2eea..420f5da3 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -1,52 +1,35 @@ PODS: - FlutterMacOS (1.0.0) - - media_kit_libs_macos_video (1.0.4): - - FlutterMacOS - - media_kit_native_event_loop (1.0.0): - - FlutterMacOS - - media_kit_video (0.0.1): - - FlutterMacOS - package_info_plus (0.0.1): - FlutterMacOS - - screen_brightness_macos (0.1.0): + - video_player_avfoundation (0.0.1): + - Flutter - FlutterMacOS - wakelock_plus (0.0.1): - FlutterMacOS DEPENDENCIES: - FlutterMacOS (from `Flutter/ephemeral`) - - media_kit_libs_macos_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_video/macos`) - - media_kit_native_event_loop (from `Flutter/ephemeral/.symlinks/plugins/media_kit_native_event_loop/macos`) - - media_kit_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos`) - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - - screen_brightness_macos (from `Flutter/ephemeral/.symlinks/plugins/screen_brightness_macos/macos`) + - video_player_avfoundation (from `Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin`) - wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`) EXTERNAL SOURCES: FlutterMacOS: :path: Flutter/ephemeral - media_kit_libs_macos_video: - :path: Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_video/macos - media_kit_native_event_loop: - :path: Flutter/ephemeral/.symlinks/plugins/media_kit_native_event_loop/macos - media_kit_video: - :path: Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos package_info_plus: :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos - screen_brightness_macos: - :path: Flutter/ephemeral/.symlinks/plugins/screen_brightness_macos/macos + video_player_avfoundation: + :path: Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin wakelock_plus: :path: Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos SPEC CHECKSUMS: FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - media_kit_libs_macos_video: b3e2bbec2eef97c285f2b1baa7963c67c753fb82 - media_kit_native_event_loop: 81fd5b45192b72f8b5b69eaf5b540f45777eb8d5 - media_kit_video: c75b07f14d59706c775778e4dd47dd027de8d1e5 - package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce - screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda - wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269 + package_info_plus: a8a591e70e87ce97ce5d21b2594f69cea9e0312f + video_player_avfoundation: 2cef49524dd1f16c5300b9cd6efd9611ce03639b + wakelock_plus: 21ddc249ac4b8d018838dbdabd65c5976c308497 PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 -COCOAPODS: 1.11.2 +COCOAPODS: 1.16.2 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index c84862c6..17a11909 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXAggregateTarget section */ @@ -21,6 +21,7 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 0CC3B9B522B7A03D6861E2E5 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D9B17AD556B4ABF6B7E3B167 /* Pods_Runner.framework */; }; 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; @@ -54,7 +55,7 @@ /* Begin PBXFileReference section */ 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -66,8 +67,12 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 6F8B762405FD0BF8EB996E04 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + D8430A8E594B478145166AB0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + D9B17AD556B4ABF6B7E3B167 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FFA1910ED868C0B0080C1EF9 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -75,6 +80,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 0CC3B9B522B7A03D6861E2E5 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -99,6 +105,7 @@ 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, + DCBB6391F70103A2AF7AC3FD /* Pods */, ); sourceTree = ""; }; @@ -148,10 +155,22 @@ D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( + D9B17AD556B4ABF6B7E3B167 /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; }; + DCBB6391F70103A2AF7AC3FD /* Pods */ = { + isa = PBXGroup; + children = ( + FFA1910ED868C0B0080C1EF9 /* Pods-Runner.debug.xcconfig */, + 6F8B762405FD0BF8EB996E04 /* Pods-Runner.release.xcconfig */, + D8430A8E594B478145166AB0 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -159,11 +178,13 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + A6C0748950A850C29D61A01D /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, + 672BEE74B09C92C74FE0A433 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -182,7 +203,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { @@ -235,6 +256,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -270,6 +292,45 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; + 672BEE74B09C92C74FE0A433 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + A6C0748950A850C29D61A01D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -344,7 +405,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -423,7 +484,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -470,7 +531,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fb7259e1..12076c83 100644 --- a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ diff --git a/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/example/macos/Runner.xcworkspace/contents.xcworkspacedata index 1d526a16..21a3cc14 100644 --- a/example/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/example/macos/Runner/AppDelegate.swift b/example/macos/Runner/AppDelegate.swift index d53ef643..b3c17614 100644 --- a/example/macos/Runner/AppDelegate.swift +++ b/example/macos/Runner/AppDelegate.swift @@ -1,9 +1,13 @@ import Cocoa import FlutterMacOS -@NSApplicationMain +@main class AppDelegate: FlutterAppDelegate { override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } } diff --git a/pubspec.yaml b/pubspec.yaml index 4a83d070..68f2efc1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,10 +11,10 @@ dependencies: flutter: sdk: flutter # services - video_player: 2.9.3 + video_player: 2.9.5 http: 1.3.0 get: 4.7.2 - wakelock_plus: 1.2.10 + wakelock_plus: 1.2.11 universal_html: 2.2.4 youtube_explode_dart: path: ../youtube_explode_dart/ From a50022ba17971569143ae12e467b728236e5d42b Mon Sep 17 00:00:00 2001 From: bigzhu Date: Sat, 7 Jun 2025 09:48:06 +0800 Subject: [PATCH 20/20] upgrade --- pubspec.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 68f2efc1..d2bae442 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,10 +11,10 @@ dependencies: flutter: sdk: flutter # services - video_player: 2.9.5 - http: 1.3.0 + video_player: ^2.10.0 + http: ^1.4.0 get: 4.7.2 - wakelock_plus: 1.2.11 + wakelock_plus: ^1.3.2 universal_html: 2.2.4 youtube_explode_dart: path: ../youtube_explode_dart/ @@ -22,7 +22,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - very_good_analysis: 7.0.0 + very_good_analysis: ^9.0.0 screenshots: - description: Pod video player logo