fix: linux audio output issues

This commit is contained in:
edde746
2025-11-21 02:36:37 +01:00
parent c27d9d09e4
commit 2562d3d4b6
2 changed files with 18 additions and 13 deletions
+17 -12
View File
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -206,6 +207,21 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen>
.getEnableHardwareDecoding();
final debugLoggingEnabled = settingsService.getEnableDebugLogging();
// Build MPV configuration
final config = <String, String>{
'sub-font-size': settingsService.getSubtitleFontSize().toString(),
'sub-color': settingsService.getSubtitleTextColor(),
'sub-border-size': settingsService.getSubtitleBorderSize().toString(),
'sub-border-color': settingsService.getSubtitleBorderColor(),
'sub-back-color':
'#${(settingsService.getSubtitleBackgroundOpacity() * 255 / 100).toInt().toRadixString(16).padLeft(2, '0').toUpperCase()}${settingsService.getSubtitleBackgroundColor().replaceFirst('#', '')}',
'sub-ass-override': 'no',
};
if (Platform.isIOS) {
config['audio-exclusive'] = 'yes';
}
// Create player with configuration
player = Player(
configuration: PlayerConfiguration(
@@ -214,18 +230,7 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen>
libassAndroidFontName: 'Droid Sans Fallback',
bufferSize: bufferSizeBytes,
logLevel: debugLoggingEnabled ? MPVLogLevel.debug : MPVLogLevel.error,
mpvConfiguration: {
'sub-font-size': settingsService.getSubtitleFontSize().toString(),
'sub-color': settingsService.getSubtitleTextColor(),
'sub-border-size': settingsService
.getSubtitleBorderSize()
.toString(),
'sub-border-color': settingsService.getSubtitleBorderColor(),
'sub-back-color':
'#${(settingsService.getSubtitleBackgroundOpacity() * 255 / 100).toInt().toRadixString(16).padLeft(2, '0').toUpperCase()}${settingsService.getSubtitleBackgroundColor().replaceFirst('#', '')}',
'sub-ass-override': 'no',
'audio-exclusive': 'yes',
},
mpvConfiguration: config,
),
);
controller = VideoController(
@@ -278,7 +278,7 @@ class _VideoSettingsSheetState extends State<VideoSettingsSheet> {
snapshot.data ?? widget.player.state.audioDevice;
final deviceLabel = currentDevice.description.isEmpty
? currentDevice.name
: currentDevice.description;
: '${currentDevice.name} · ${currentDevice.description}';
return _SettingsMenuItem(
icon: Icons.speaker,