Skip to content

Conversation

@kalashnikxvxiii
Copy link

Summary

This PR enhances the media widget's fallback mode to provide full functionality when Windows Media Session Manager is unavailable.

Changes

  • Per-session audio peak detection: Implements accurate playback state detection using IAudioMeterInformation for each audio session
  • Process ID verification: Adds robust Spotify window title detection by verifying process ownership before reading window titles
  • Track information display: Shows actual artist and title information instead of placeholder text
  • Application icon: Displays the media player's icon aligned to the right edge of the widget container

Testing

Tested with:

  • Spotify on Windows 10/11 with Komorebi window manager
  • Verified peak detection accuracy and window title parsing
  • Confirmed scrolling label and click callbacks work in fallback mode

Closes

Fixes #599

- Implement per-session audio peak detection for accurate playback state
- Add process ID verification for Spotify window title detection
- Display actual track information (artist - title) instead of placeholder
- Add application icon display aligned to right edge of widget container

Fixes amnweb#599
@kalashnikxvxiii
Copy link
Author

kalashnikxvxiii commented Dec 30, 2025

Hey everyone! Quick update about browser media support (YouTube, Spotify Web, etc.).

What I tried:
I attempted to implement browser tab detection for media playback. The code can detect when you have media-playing tabs open (YouTube, Spotify Web, etc.) and correctly enables the media controls. That part works fine!

The problem:
Unfortunately, the media controls don't actually DO anything when it comes to browser media. The buttons show up correctly, they respond to clicks, but nothing happens in the browser tab. The play/pause and track navigation
commands just don't have any effect on web-based media players.

Current solution:
For now, I've set `is_browser` to always return `False` in the `_detect_audio_playing()` function. This way the fallback mode still works perfectly for desktop media apps (Spotify desktop, VLC, etc.) and doesn't show
broken controls for browser media.


I left all the browser detection code (`_get_browser_media_windows()`, browser patterns in `media.py`, etc.) in the PR instead of removing it completely. Maybe someone has ideas on how to make the media commands
work with browsers? Or maybe there's a different approach I haven't thought of yet.

If anyone has experience with controlling browser media playback via Windows API or has any suggestions, I'd really appreciate the help! I'll keep working on this in the meantime.

The desktop media player support with peak detection works great though, so at least we have that! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ERROR] [MainThread] [root/widget_builder.py:79]: Failed to import widget 'media' with default config.yaml

1 participant