Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the library without winit::event_loop #23

Closed
aome510 opened this issue May 26, 2022 · 5 comments
Closed

Using the library without winit::event_loop #23

aome510 opened this issue May 26, 2022 · 5 comments

Comments

@aome510
Copy link

aome510 commented May 26, 2022

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
Copy link
Owner

Sinono3 commented Jun 1, 2022

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
Copy link
Contributor

YXL76 commented Jun 1, 2022

Media control is only available for window processes on MacOS.

@aome510
Copy link
Author

aome510 commented Jun 6, 2022

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.

@aome510 aome510 closed this as completed Jun 6, 2022
@Sinono3
Copy link
Owner

Sinono3 commented Jun 8, 2022

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.

@ILikeTeaALot
Copy link

ILikeTeaALot commented Dec 2, 2024

From my experience with a NodeJS library I used with Electron (electron-media-service), it is likely that an application event-loop is required (i.e. Winit's event_loop), but a window itself is not strictly required (as it is common for Mac OS applications to continue running despite no open windows, the event loop would continue anyway)

I think the specific requirement would be a running AppDelegate, regardless of the existence of any windows.

(This also requires that the code be running on the main application thread, as Mac OS doesn't support having the AppDelegate on another thread)

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

No branches or pull requests

4 participants