Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove manual video player switcher

ashilknd281dc11701a
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index c22d8b541a..f7d661dec1 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -1606,7 +1606,6 @@
},
"legacyInvite": "{email} has invited you to be a trusted contact",
"authToManageLegacy": "Please authenticate to manage your trusted contacts",
- "useDifferentPlayerInfo": "Having trouble playing this video? Long press here to try a different player.",
"hideSharedItemsFromHomeGallery": "Hide shared items from home gallery",
"gallery": "Gallery",
"joinAlbum": "Join album",
diff --git a/mobile/apps/photos/lib/ui/viewer/file/video_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/video_widget.dart
index fa9468d94a..1cc95272b9 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/video_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/video_widget.dart
@@ -54,9 +54,12 @@ class _VideoWidgetState extends State<VideoWidget> {
@override
void initState() {
super.initState();
+ // Automatic error fallback: switch to MediaKit when native player fails
useMediaKitForVideoSubscription =
Bus.instance.on<UseMediaKitForVideo>().listen((event) {
- _logger.info("Switching to MediaKit for video playback");
+ _logger.info(
+ "Automatically switching to MediaKit due to native player error",
+ );
setState(() {
useNativeVideoPlayer = false;
});
diff --git a/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart b/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart
index 3e52a36791..86a20f4f92 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart
@@ -1,9 +1,7 @@
import "dart:async";
import "dart:io";
-import "package:el_tooltip/el_tooltip.dart";
import "package:flutter/material.dart";
-import "package:flutter/services.dart";
import "package:logging/logging.dart";
import "package:native_video_player/native_video_player.dart";
import "package:photos/core/constants.dart";
@@ -84,7 +82,6 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
final _debouncer = Debouncer(
const Duration(milliseconds: 2000),
);
- final _elTooltipController = ElTooltipController();
StreamSubscription<PlaybackEvent>? _subscription;
StreamSubscription<StreamSwitchedEvent>? _streamSwitchedSubscription;
StreamSubscription<DownloadTask>? downloadTaskSubscription;
@@ -247,7 +244,6 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
_isSeeking.removeListener(_seekListener);
_isSeeking.dispose();
_debouncer.cancelDebounceTimer();
- _elTooltipController.dispose();
_captionUpdatedSubscription.cancel();
EnteWakeLockService.instance
.updateWakeLock(enable: false, wakeLockFor: WakeLockFor.videoPlayback);
@@ -309,7 +305,6 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
widget
.playbackCallback!(!_showControls.value);
}
- _elTooltipController.hide();
},
onLongPress: () {
if (widget.isFromMemories) {
@@ -327,25 +322,6 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
constraints: const BoxConstraints.expand(),
),
),
- Platform.isAndroid
- ? Positioned(
- bottom: verticalMargin,
- right: 0,
- child: SafeArea(
- child: GestureDetector(
- onLongPress: () {
- Bus.instance.fire(UseMediaKitForVideo());
- HapticFeedback.vibrate();
- },
- child: Container(
- width: 100,
- height: 180,
- color: Colors.transparent,
- ),
- ),
- ),
- )
- : const SizedBox.shrink(),
widget.isFromMemories
? const SizedBox.shrink()
: Positioned.fill(
@@ -396,14 +372,6 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
- _VideoDescriptionAndSwitchToMediaKitButton(
- file: widget.file,
- showControls: _showControls,
- elTooltipController:
- _elTooltipController,
- controller: _controller,
- selectedPreview: widget.selectedPreview,
- ),
ValueListenableBuilder(
valueListenable: _showControls,
builder: (context, value, _) {
@@ -873,105 +841,3 @@ class _SeekBarAndDuration extends StatelessWidget {
);
}
}
-
-class _VideoDescriptionAndSwitchToMediaKitButton extends StatelessWidget {
- final EnteFile file;
- final ValueNotifier<bool> showControls;
- final ElTooltipController elTooltipController;
- final NativeVideoPlayerController? controller;
- final bool selectedPreview;
-
- const _VideoDescriptionAndSwitchToMediaKitButton({
- required this.file,
- required this.showControls,
- required this.elTooltipController,
- required this.controller,
- required this.selectedPreview,
- });
-
- @override
- Widget build(BuildContext context) {
- return Platform.isAndroid && !selectedPreview
- ? Align(
- alignment: Alignment.centerRight,
- child: ValueListenableBuilder(
- valueListenable: showControls,
- builder: (context, value, _) {
- return IgnorePointer(
- ignoring: !value,
- child: AnimatedOpacity(
- duration: const Duration(milliseconds: 200),
- curve: Curves.easeInQuad,
- opacity: value ? 1 : 0,
- child: ElTooltip(
- padding: const EdgeInsets.all(12),
- distance: 4,
- controller: elTooltipController,
- content: GestureDetector(
- onLongPress: () {
- Bus.instance.fire(
- UseMediaKitForVideo(),
- );
- HapticFeedback.vibrate();
- elTooltipController.hide();
- },
- child: Text(
- AppLocalizations.of(context).useDifferentPlayerInfo,
- ),
- ),
- position: ElTooltipPosition.topEnd,
- color: backgroundElevatedDark,
- appearAnimationDuration: const Duration(
- milliseconds: 200,
- ),
- disappearAnimationDuration: const Duration(
- milliseconds: 200,
- ),
- child: GestureDetector(
- onTap: () {
- if (elTooltipController.value ==
- ElTooltipStatus.hidden) {
- elTooltipController.show();
- } else {
- elTooltipController.hide();
- }
- controller?.pause();
- },
- behavior: HitTestBehavior.translucent,
- onLongPress: () {
- Bus.instance.fire(
- UseMediaKitForVideo(),
- );
- HapticFeedback.vibrate();
- },
- child: Padding(
- padding: const EdgeInsets.fromLTRB(12, 0, 0, 4),
- child: Container(
- padding: const EdgeInsets.all(12),
- child: Stack(
- alignment: Alignment.bottomRight,
- children: [
- Icon(
- Icons.play_arrow_outlined,
- size: 24,
- color: Colors.white.withValues(alpha: 0.2),
- ),
- Icon(
- Icons.question_mark_rounded,
- size: 10,
- color: Colors.white.withValues(alpha: 0.2),
- ),
- ],
- ),
- ),
- ),
- ),
- ),
- ),
- );
- },
- ),
- )
- : const SizedBox.shrink();
- }
-}
diff --git a/mobile/apps/photos/pubspec.lock b/mobile/apps/photos/pubspec.lock
index 43fc965232..e6582a3201 100644
--- a/mobile/apps/photos/pubspec.lock
+++ b/mobile/apps/photos/pubspec.lock
@@ -517,14 +517,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.9"
- el_tooltip:
- dependency: "direct main"
- description:
- name: el_tooltip
- sha256: "0860b00e9390a31dd98369dc16d3b6fa2668fc52df712bd00e86d8931787fc17"
- url: "https://pub.dev"
- source: hosted
- version: "2.2.1"
email_validator:
dependency: "direct main"
description:
diff --git a/mobile/apps/photos/pubspec.yaml b/mobile/apps/photos/pubspec.yaml
index a7458764aa..264848dace 100644
--- a/mobile/apps/photos/pubspec.yaml
+++ b/mobile/apps/photos/pubspec.yaml
@@ -48,7 +48,6 @@ dependencies:
dots_indicator: ^4.0.1
dotted_border: ^2.1.0
dropdown_button2: ^2.0.0
- el_tooltip: ^2.2.1
email_validator: ^3.0.0
encrypt: ^5.0.3
ente_cast: