| 123456789101112131415161718192021222324252627 |
- import '../../core/app_identity.dart';
- import '../../data/models/media_playback.dart';
- /// Whether the current system media session belongs to another app.
- ///
- /// CarDash's own Jellyfin player also publishes a MediaSession. While Jellyfin
- /// pauses, the system snapshot can still report that session as playing for up
- /// to one poll (~900 ms), so it must not be treated as external music.
- bool isExternalSystemMedia(MediaPlayback media) {
- return media.packageName != appPackageName;
- }
- /// Whether the Music tile should show its animated equalizer.
- ///
- /// A Jellyfin pause updates the Jellyfin controller immediately, while the
- /// Android media snapshot can remain playing for one system poll. The Music
- /// tile must stay quiet during that gap instead of flashing until the next
- /// poll: if the active session is CarDash's own Jellyfin session, it is not
- /// another app's music.
- bool shouldShowMusicEqualizer({
- required bool systemMusicPlaying,
- required bool jellyfinPlaying,
- required MediaPlayback systemMedia,
- }) {
- if (!systemMusicPlaying || jellyfinPlaying) return false;
- return isExternalSystemMedia(systemMedia);
- }
|