this change fixes the garbled audio on my Pixel 6a while the screen is off. Not familiar with libmpv, but seems to favor audiotrack audio output over opensles. KRTirtho/spotube#571

This commit is contained in:
Olivier Martin 2024-02-07 22:46:27 -05:00
parent 5d0b5e69a5
commit 0e73443471

View File

@ -1,5 +1,5 @@
import 'dart:async';
import 'package:flutter_desktop_tools/flutter_desktop_tools.dart';
import 'package:catcher_2/catcher_2.dart';
import 'package:collection/collection.dart';
import 'package:media_kit/media_kit.dart';
@ -64,6 +64,12 @@ class MkPlayerWithState extends Player {
Catcher2.reportCheckedError('[MediaKitError] \n$event', null);
}),
];
if (super.platform is NativePlayer) {
NativePlayer playerNative = super.platform as NativePlayer;
if (DesktopTools.platform.isAndroid) {
playerNative.setProperty("ao", "audiotrack,opensles");
}
}
}
bool get shuffled => _shuffled;