thewh1teagle / mobslide

Turn your smartphone into presentation remote controller
https://thewh1teagle.github.io/mobslide.web
MIT License
347 stars 18 forks source link

Volumes buttons does not work on MacOS #1

Closed paulora2405 closed 9 months ago

paulora2405 commented 10 months ago

Currently trying this project, and I've encountered some problems:

The QR Code never loads, it stays spinning forever, as seen below:

image

Also, another problem that I'm not entirely sure is related or not to the first problem. Even if I copy the URL manually and paste it in my browser or send it to my mobile device, it isn't able to connect:

image

I'm running the project in MacOS 14, with Apple Silicon, building from source.

thewh1teagle commented 10 months ago

Unfortunately I havn't tested it on MacOS yet becasue I don't have one. Can you pull and try again? I changed something that may related to that, added console logs, and allow open devtools in any build If you try and it shows some error please send screenshot or even paste it here

paulora2405 commented 10 months ago

Here you go:

image

It looks like the problem is that the connection with the PeerJS module's server is failing. I'm not sure how the app works, I've only read your comments in the r/rust post.

thewh1teagle commented 10 months ago

Thank you! I checked and found that peerjs library default signaling servers are not worked properly, and the library was dependent on that.

So I launched our own signaling servers and it solved the problem (at least for me). Can you try it again?

Releases

paulora2405 commented 10 months ago

Thanks for the swift fixes!

I've tested in the dev environment, and the QR Code successfully generates, but clicking the link doesn't connect to the App (even in the same host/machine):

image image

I'm no really sure how it's supposed to work locally, but this line here ensures that the App uses localhost for the dev environment. In the DevTools console, there is no error what so ever.

As for the production/built version, the QR Code is successfully generated, and both my own machine running the App, and my mobile device are able to connect. The pageup and pagedown buttons work (although they are kinda funky in Preview, macOS's PDF viewer, but work great in Google Slides).

But the volumeup and volumedown buttons don't work at all, I've got a suspicion that it has got something to do with the accessibility controls permission from macOS, because when first clicking the button on the Client side of the App, my machine asked if I wanted to concede this permissions to mobside, but I think volume controls may work differently.

Any way, that's all I've figured out, I really would like to be able to run locally in dev mode, so I can maybe help this project, could you provide a little guide on what is needed for it to work?

thewh1teagle commented 10 months ago

Great to hear that QR is working!

I added development instructions to the README

thewh1teagle commented 10 months ago

About volume keys:

See https://github.com/enigo-rs/enigo/issues/248#issuecomment-1818915105

Can you try changing version in desktop/Cargo.toml to enigo = "0.2.0-rc2"

And then check if volume buttons work?

pentamassiv commented 10 months ago

I changed the API. You have to change the code too for it to work with enigo = "0.2.0-rc2"

thewh1teagle commented 10 months ago

@pentamassiv Thanks for letting know. btw your example doc of this version missing the import of the traits itself.

@paulora2405 I've updated the latest code to latest enigo version which should fix the problem. Just git pull and try again, and let me know if it works : - )

paulora2405 commented 10 months ago

Hello, just tried the new version. I was actually in the process of trying to adapt the code to the rc version of enigo, but you were faster. Unfortunately, the volume buttons are still not working at all, when running in dev mode.

I've tried running the built version also, but strangely, in this version not even the pageup and pagedown buttons work.

A signal is received by the server app, but the key press is not emitted or something.

image

Another thing is that when trying to access the QR Code URL via Mobile, it redirects to http://localhost:5173/mobslide/?id=...., I think the URL in the development environment could be to the server's Lan IP, as is instructed to access via the web part of the App:

image
thewh1teagle commented 10 months ago

I didn't found a way to find the server URL from vite / React, that's why I used just localhost and instead of opening in the mobile phone I just open it in the browser of the PC.

pentamassiv commented 10 months ago

Thank you both for investigating this further. The newest enigo version has a log backend. I created https://github.com/thewh1teagle/mobslide/pull/3. Could you please try running the application with that and send me the log output?

pentamassiv commented 10 months ago

I don't have a mac available all the time and often test my code in a VM, which is a hassle to set up, otherwise I'd try it myself.

thewh1teagle commented 10 months ago

I think that I found the problem: in your library when sending VolumeDown Key you use VK_VOLUME_UP from windows crate. the value of it is 175u16 (175). and the value that should be on MacOS is 0x49 which is 73.

Update, sorry I missed something there you use the right keycode

thewh1teagle commented 10 months ago

Added logging mobslide#debugging

@paulora2405 Can you try it with this logging method? We will see if it pressing and what's going on in enigo library

paulora2405 commented 10 months ago

I'm not sure if I'm doing something wrong, but the key presses don't show up in any console:

image

I think this is simply due to Tauri not logging the Rust part of the App into console. I've validated this by adding the following lines in desktop/src-tauri/src/main.rs:

info!("Info!!");
debug!("Debug!!");

And indeed they are never printed.

thewh1teagle commented 10 months ago

Did you typed export RUST_LOG=trace Before running cargo tauri dev?

You can also just do RUST_LOG=trace cargo tauri dev in single line

paulora2405 commented 10 months ago

I did not, and that my bad, sorry. Here is the console log:

image

The volume keys are correctly being pressed, but nothing is happening, I've validated that the functionality itself works by using a bluetooth headphone that has volume controls, and pressing those actually changes the volume slider in the system, but the key presses from the App don't.

pentamassiv commented 10 months ago

It looks as expected and is fine. You can stop debugging it. I just remembered, that I already created an issue for that a few weeks ago ^^. Sorry about that! I opened it in my fork of enigo. That is why you did not see it. Here is the PR: https://github.com/pentamassiv/enigo/issues/28

pentamassiv commented 10 months ago

I'll use the VM to implement and test it. Here is how to do that, just in case you (@thewh1teagle) want to use it for testing your software as well: https://github.com/enigo-rs/enigo/issues/141#issuecomment-1763462915

paulora2405 commented 10 months ago

Thanks @pentamassiv, I got really interested in both this project right here, and also yours as well, I was looking for more open source projects to contribute, so maybe I'll start with these two.

As for testing for macOS, quite recently I've read about this project right here which promises to deliver a macOS docker container for exactly this kind of usage. You should check it out.

pentamassiv commented 10 months ago

I am always happy about contributions :-) Let me know if you want me to suggest issues you can start with.

Thank you for the suggested container. It is the same project I mentioned in the linked comment. If you want to give it a try, you should be able to install podman (or docker) and use the linked command. The ones mentioned in the repo for some reason did not work for me.

It should also be possible to use Github Actions to test everything. Github changed some permissions so that is possible. All I had to do is ask :P https://github.com/actions/runner-images/issues/7269. Unfortunately I have not been able to get it to work regardless :/

paulora2405 commented 10 months ago

I see, the concept of using it in a GitHub action is very interesting to me.

As for pointing to some good-to-start issues, yes, I would like that. This issue of macOS function keys shouldn't be to hard to solve right? Maybe I could start with that, given that I would have an easier time testing it seen as I'm running the target OS of the issue.

thewh1teagle commented 9 months ago

Fixed in latest version 0.0.2 and released, tested on MacOS 13.5 and it works. Currenly it's uses inline apple script until enigo will support media keys.

Releases