fix(android): apply dv conversion mode during init

This commit is contained in:
edde746
2026-05-18 20:32:34 +02:00
parent d85a622fbe
commit f4f2571168
3 changed files with 84 additions and 23 deletions
+9 -1
View File
@@ -195,7 +195,15 @@ class PlayerAndroid extends PlayerBase {
break;
case 'dv-conversion-mode':
_dvConversionMode = value;
if (initialized) await invoke('setDvConversionMode', {'mode': value});
final initFuture = _initFuture;
if (initialized) {
await invoke('setDvConversionMode', {'mode': value});
} else if (initFuture != null) {
await initFuture;
if (!disposed && initialized && _dvConversionMode == value) {
await invoke('setDvConversionMode', {'mode': value});
}
}
break;
case 'sub-visibility':
if (value == 'no') {
+6 -7
View File
@@ -566,13 +566,6 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
player = currentPlayer;
_playerBackendLabel = currentPlayer.playerType;
// Kick off audio-focus negotiation in parallel with MPV config + prefetch.
// On Android this is a round-trip to AudioManager (~90ms cold).
if (Platform.isAndroid && !widget.isLive) {
_audioFocusFuture = currentPlayer.requestAudioFocus();
_audioFocusFuture!.ignore();
}
// Kick off getPlaybackData() in parallel with the rest of MPV setup.
// The network/DB work has no dependency on the player — it just needs
// the context (providers), which is still safe to touch here because
@@ -670,6 +663,12 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
}
}
}
// requestAudioFocus initializes Android players, so start it only after
// init-time ExoPlayer options above have been cached.
if (Platform.isAndroid && !widget.isLive) {
_audioFocusFuture = currentPlayer.requestAudioFocus();
_audioFocusFuture!.ignore();
}
await currentPlayer.setProperty('msg-level', debugLoggingEnabled ? 'all=debug' : 'all=error');
await currentPlayer.setLogLevel(debugLoggingEnabled ? 'v' : 'warn');
await currentPlayer.setProperty('hwdec', _getHwdecValue(enableHardwareDecoding));