video: disable subtitles by default

This commit is contained in:
Thibault Deckers 2023-10-02 00:23:09 +02:00
parent 541d26ca16
commit 6f6cd3a84a
6 changed files with 15 additions and 3 deletions

View file

@ -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
## <a id="v1.9.6"></a>[v1.9.6] - 2023-09-25

View file

@ -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;

View file

@ -72,6 +72,9 @@ extension ExtraAvesEntryInfo on AvesEntry {
Future<List<MetadataDirectory>> _getStreamDirectories(BuildContext context) async {
final directories = <MetadataDirectory>[];
final mediaInfo = await videoMetadataFetcher.getMetadata(this);
if (!context.mounted) {
return directories;
}
final formattedMediaTags = VideoMetadataFormatter.formatInfo(mediaInfo);
if (formattedMediaTags.isNotEmpty) {

View file

@ -140,12 +140,15 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
Future<void> _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<Map<MediaStreamType, MediaStreamSummary?>>(
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),
);

View file

@ -11,6 +11,8 @@ mixin AvesEntryBase {
String? get path;
String? get bestTitle;
int? get sizeBytes;
int? get durationMillis;

View file

@ -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);
}