Sinono3 / souvlaki

A cross-platform library for handling OS media controls and metadata.
MIT License
79 stars 15 forks source link

Using the library without `winit::event_loop` #23

Closed aome510 closed 2 years ago

aome510 commented 2 years ago

Hi, I'm trying to use this library in MacOS Monterey 12.3.1.

Running examples/print_events doesn't work (no media event printed even when I press one, no metadata shown up in the media control). Running example/example.rs works perfectly but I'm not sure I understand the requirement of winit library here. winit and winit::event_loop seem to be the only difference between examples/print_events.rs and examples/example.rs

Does souvlaki work without winit, as I see that winit is only included as the devdependencies? Am I missing something here?

Sinono3 commented 2 years ago

Hi. To run in Windows, souvlaki needs a raw window handle also known as HWND. In MacOS and Linux, a window handle isn't required, so the print_events example should work. That's weird. I can't comment much on the MacOS implementation since I didn't write it (@jpochyla). Maybe it has to do with the thread being blocked. Can you try opening the media controls in another thread and/or reducing the sleep time?

YXL76 commented 2 years ago

Media control is only available for window processes on MacOS.

aome510 commented 2 years ago

Maybe it has to do with the thread being blocked. Can you try opening the media controls in another thread and/or reducing the sleep time?

Still not work AFAICT. I guess the reason is because MacOS needs an open window to listen to the events, as other mentioned.

Will close this issue for now. Thanks.

Sinono3 commented 2 years ago

I'd appreciate if someone with access to MacOS could pin down the behaviour of media controls and window processes, so it can be stated in the crate's documentation and prevent misunderstandings. I'm going to put a warning in the docs for now.