video: disable subtitles by default
This commit is contained in:
parent
541d26ca16
commit
6f6cd3a84a
6 changed files with 15 additions and 3 deletions
|
@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- mosaic layout: clamp ratio to 32/9
|
- mosaic layout: clamp ratio to 32/9
|
||||||
|
- Video: disable subtitles by default
|
||||||
|
|
||||||
## <a id="v1.9.6"></a>[v1.9.6] - 2023-09-25
|
## <a id="v1.9.6"></a>[v1.9.6] - 2023-09-25
|
||||||
|
|
||||||
|
|
|
@ -331,6 +331,7 @@ class AvesEntry with AvesEntryBase {
|
||||||
|
|
||||||
String? _bestTitle;
|
String? _bestTitle;
|
||||||
|
|
||||||
|
@override
|
||||||
String? get bestTitle {
|
String? get bestTitle {
|
||||||
_bestTitle ??= _catalogMetadata?.xmpTitle?.isNotEmpty == true ? _catalogMetadata!.xmpTitle : (filenameWithoutExtension ?? sourceTitle);
|
_bestTitle ??= _catalogMetadata?.xmpTitle?.isNotEmpty == true ? _catalogMetadata!.xmpTitle : (filenameWithoutExtension ?? sourceTitle);
|
||||||
return _bestTitle;
|
return _bestTitle;
|
||||||
|
|
|
@ -72,6 +72,9 @@ extension ExtraAvesEntryInfo on AvesEntry {
|
||||||
Future<List<MetadataDirectory>> _getStreamDirectories(BuildContext context) async {
|
Future<List<MetadataDirectory>> _getStreamDirectories(BuildContext context) async {
|
||||||
final directories = <MetadataDirectory>[];
|
final directories = <MetadataDirectory>[];
|
||||||
final mediaInfo = await videoMetadataFetcher.getMetadata(this);
|
final mediaInfo = await videoMetadataFetcher.getMetadata(this);
|
||||||
|
if (!context.mounted) {
|
||||||
|
return directories;
|
||||||
|
}
|
||||||
|
|
||||||
final formattedMediaTags = VideoMetadataFormatter.formatInfo(mediaInfo);
|
final formattedMediaTags = VideoMetadataFormatter.formatInfo(mediaInfo);
|
||||||
if (formattedMediaTags.isNotEmpty) {
|
if (formattedMediaTags.isNotEmpty) {
|
||||||
|
|
|
@ -140,12 +140,15 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
||||||
Future<void> _showStreamSelectionDialog(BuildContext context, AvesVideoController controller) async {
|
Future<void> _showStreamSelectionDialog(BuildContext context, AvesVideoController controller) async {
|
||||||
final streams = controller.streams;
|
final streams = controller.streams;
|
||||||
final currentSelectedStreams = await Future.wait(MediaStreamType.values.map(controller.getSelectedStream));
|
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?>>(
|
final userSelectedStreams = await showDialog<Map<MediaStreamType, MediaStreamSummary?>>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => VideoStreamSelectionDialog(
|
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),
|
routeSettings: const RouteSettings(name: VideoStreamSelectionDialog.routeName),
|
||||||
);
|
);
|
||||||
|
|
|
@ -11,6 +11,8 @@ mixin AvesEntryBase {
|
||||||
|
|
||||||
String? get path;
|
String? get path;
|
||||||
|
|
||||||
|
String? get bestTitle;
|
||||||
|
|
||||||
int? get sizeBytes;
|
int? get sizeBytes;
|
||||||
|
|
||||||
int? get durationMillis;
|
int? get durationMillis;
|
||||||
|
|
|
@ -49,7 +49,8 @@ class MpvVideoController extends AvesVideoController {
|
||||||
_statusStreamController.add(_status);
|
_statusStreamController.add(_status);
|
||||||
|
|
||||||
_instance = Player(
|
_instance = Player(
|
||||||
configuration: const PlayerConfiguration(
|
configuration: PlayerConfiguration(
|
||||||
|
title: entry.bestTitle ?? entry.uri,
|
||||||
libass: false,
|
libass: false,
|
||||||
logLevel: MPVLogLevel.warn,
|
logLevel: MPVLogLevel.warn,
|
||||||
),
|
),
|
||||||
|
@ -106,6 +107,7 @@ class MpvVideoController extends AvesVideoController {
|
||||||
|
|
||||||
await _applyLoop();
|
await _applyLoop();
|
||||||
await _instance.open(Media(entry.uri), play: playing);
|
await _instance.open(Media(entry.uri), play: playing);
|
||||||
|
await _instance.setSubtitleTrack(SubtitleTrack.no());
|
||||||
if (startMillis > 0) {
|
if (startMillis > 0) {
|
||||||
await seekTo(startMillis);
|
await seekTo(startMillis);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue