diff --git a/CHANGELOG.md b/CHANGELOG.md index 59699a7dd..849326e5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Changed - mosaic layout: clamp ratio to 32/9 +- Video: disable subtitles by default ## [v1.9.6] - 2023-09-25 diff --git a/lib/model/entry/entry.dart b/lib/model/entry/entry.dart index 1c7075143..a58d369b2 100644 --- a/lib/model/entry/entry.dart +++ b/lib/model/entry/entry.dart @@ -331,6 +331,7 @@ class AvesEntry with AvesEntryBase { String? _bestTitle; + @override String? get bestTitle { _bestTitle ??= _catalogMetadata?.xmpTitle?.isNotEmpty == true ? _catalogMetadata!.xmpTitle : (filenameWithoutExtension ?? sourceTitle); return _bestTitle; diff --git a/lib/model/entry/extensions/info.dart b/lib/model/entry/extensions/info.dart index 6aa21abd3..115a5bb9f 100644 --- a/lib/model/entry/extensions/info.dart +++ b/lib/model/entry/extensions/info.dart @@ -72,6 +72,9 @@ extension ExtraAvesEntryInfo on AvesEntry { Future> _getStreamDirectories(BuildContext context) async { final directories = []; final mediaInfo = await videoMetadataFetcher.getMetadata(this); + if (!context.mounted) { + return directories; + } final formattedMediaTags = VideoMetadataFormatter.formatInfo(mediaInfo); if (formattedMediaTags.isNotEmpty) { diff --git a/lib/widgets/viewer/action/video_action_delegate.dart b/lib/widgets/viewer/action/video_action_delegate.dart index 739e79bb1..847fd0cf7 100644 --- a/lib/widgets/viewer/action/video_action_delegate.dart +++ b/lib/widgets/viewer/action/video_action_delegate.dart @@ -140,12 +140,15 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix Future _showStreamSelectionDialog(BuildContext context, AvesVideoController controller) async { final streams = controller.streams; final currentSelectedStreams = await Future.wait(MediaStreamType.values.map(controller.getSelectedStream)); - final currentSelectedIndices = currentSelectedStreams.whereNotNull().map((v) => v.index).toSet(); final userSelectedStreams = await showDialog>( context: context, builder: (context) => VideoStreamSelectionDialog( - streams: Map.fromEntries(streams.map((stream) => MapEntry(stream, currentSelectedIndices.contains(stream.index)))), + streams: Map.fromEntries(streams.map((stream) { + final selectedStream = currentSelectedStreams.whereNotNull().firstWhereOrNull((v) => v.type == stream.type); + final selected = selectedStream != null && selectedStream.index == stream.index; + return MapEntry(stream, selected); + })), ), routeSettings: const RouteSettings(name: VideoStreamSelectionDialog.routeName), ); diff --git a/plugins/aves_model/lib/src/entry/base.dart b/plugins/aves_model/lib/src/entry/base.dart index 68346d1eb..716cd96ab 100644 --- a/plugins/aves_model/lib/src/entry/base.dart +++ b/plugins/aves_model/lib/src/entry/base.dart @@ -11,6 +11,8 @@ mixin AvesEntryBase { String? get path; + String? get bestTitle; + int? get sizeBytes; int? get durationMillis; diff --git a/plugins/aves_video_mpv/lib/src/controller.dart b/plugins/aves_video_mpv/lib/src/controller.dart index f1f0cbba6..0f1709671 100644 --- a/plugins/aves_video_mpv/lib/src/controller.dart +++ b/plugins/aves_video_mpv/lib/src/controller.dart @@ -49,7 +49,8 @@ class MpvVideoController extends AvesVideoController { _statusStreamController.add(_status); _instance = Player( - configuration: const PlayerConfiguration( + configuration: PlayerConfiguration( + title: entry.bestTitle ?? entry.uri, libass: false, logLevel: MPVLogLevel.warn, ), @@ -106,6 +107,7 @@ class MpvVideoController extends AvesVideoController { await _applyLoop(); await _instance.open(Media(entry.uri), play: playing); + await _instance.setSubtitleTrack(SubtitleTrack.no()); if (startMillis > 0) { await seekTo(startMillis); }