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

"--enable-features=GamepadExtensions" Chromium Arg Doesn't Work With Certain User-Agents #6512

Closed
TheRealDannyyy opened this issue Mar 13, 2018 · 25 comments

Comments

Projects
None yet
4 participants
@TheRealDannyyy
Copy link

commented Mar 13, 2018

Information

NWJS Version : v0.29.0
Operating System : Windows 7 (SP1)

Expected behavior

js flag
Adding this to the manifest should enable the experimental gamepad extensions API but it doesn't seem to work. Am I doing something wrong or is this js flag not supported yet?

Actual behavior

js flag chrome
Adding the flag to the manifest should work just like manually enabling it in chrome://flags/.

Example for reproduction

Download: package file.zip

How to reproduce

  1. Run package file with NW.js running on M65 or newer
  2. Wait until haptic feedback testing website is loaded
  3. Test haptic feedback using a controller that supports it (e.g. XBox 360 gamepad)
    1. Connect gamepad and press button, it should be automatically selected on the top-left
    2. Fill in the required information (e.g. 0 | 1.0 | 1.0 | 1000)
    3. Click on "rumble" button
  4. Notice it doesn't work as expected because js flag isn't properly enabled
@Christywl

This comment has been minimized.

Copy link
Contributor

commented Mar 14, 2018

@TheRealDannyyy , I try it on Windows 10 with nwjs-sdk-v0.29.0. The result is 'haptic effect errored' after clicking 'rumble' button. Is this the same as yours?
image

@Christywl Christywl added the needinfo label Mar 14, 2018

@TheRealDannyyy

This comment has been minimized.

Copy link
Author

commented Mar 14, 2018

@Christywl yes same for me, it's because the required js-flag isn't enabled.
I'm not sure why it isn't since I did everything based on the NW.js documentation.

@rogerwang

This comment has been minimized.

Copy link
Member

commented Mar 19, 2018

This should be used: --enable-features=GamepadExtensions

@rogerwang rogerwang closed this Mar 19, 2018

@TheRealDannyyy

This comment has been minimized.

Copy link
Author

commented Mar 19, 2018

@rogerwang I've tried that as a js-flag, chromium-arg and also added it to a shortcut as a command-line argument and nothing worked.

Does it work on your end or am I doing something wrong?

@rogerwang

This comment has been minimized.

Copy link
Member

commented Mar 19, 2018

I didn't try it with your sample. I verified that the API is there with the switch.

@rogerwang

This comment has been minimized.

Copy link
Member

commented Mar 19, 2018

btw, I put it in the command line. chromium-arg should work too. but it's not a 'js-flag'.

@TheRealDannyyy

This comment has been minimized.

Copy link
Author

commented Mar 19, 2018

@rogerwang Still doesn't work for me, not sure what's wrong. (Tested in Nw.js v0.29.0)
This is what I'm using: Package File With Arg.zip

@Armaldio

This comment has been minimized.

Copy link

commented Mar 20, 2018

@rogerwang Nothing work for me either
I've also tried with a vanilla NW.js app and a minimal package.json file
nw.zip

npm run start or npm run startArg

@rogerwang rogerwang reopened this Mar 21, 2018

@TheRealDannyyy

This comment has been minimized.

Copy link
Author

commented Mar 29, 2018

@rogerwang Did you have the time to look into whats going wrong yet?
I would really appreciate if this gets fixed in the v0.30.0 stable release if possible.

@rogerwang

This comment has been minimized.

Copy link
Member

commented Mar 31, 2018

Yeah, will try to fix it before 0.30.0 release.

@rogerwang

This comment has been minimized.

Copy link
Member

commented Mar 31, 2018

btw, can it be tested without any gamepad device?

@TheRealDannyyy

This comment has been minimized.

Copy link
Author

commented Mar 31, 2018

@rogerwang I guess the easiest way to test if it works without a gamepad would be by doing the following:

  1. Start nw.exe with fixed chromium arg
  2. Press F12 to open Dev-tools
  3. Go to "Console" tab and run: window.open('chrome://flags/');
  4. Search for "Gamepad Extensions" flag and check if it's enabled

(You can also feel free to share a testing build so we can do the testing for you.)

@rogerwang

This comment has been minimized.

Copy link
Member

commented Apr 2, 2018

@TheRealDannyyy It's Default here -- means the end user doesn't set the flag. It should be enabled by the command line.

@TheRealDannyyy

This comment has been minimized.

Copy link
Author

commented Apr 2, 2018

@rogerwang It works using a shortcut and command-line but I would like to enable it using the manifest.
Could you add support for it in the manifest or fix it if it's not working as intended if possible?

(Tested using NW.js v0.30.0-beta1)

@rogerwang

This comment has been minimized.

Copy link
Member

commented Apr 2, 2018

--enable-features is supposed to work in chromium-args in manifest. Does it work for you?

@TheRealDannyyy

This comment has been minimized.

Copy link
Author

commented Apr 2, 2018

@rogerwang I tried --enable-features=GamepadExtensions with both my and Armaldio's examples above and they didn't work. There must be an issue with NW.js not reading or activating it properly.

@rogerwang

This comment has been minimized.

Copy link
Member

commented Apr 3, 2018

I tried with the following manifest and it should be enabled:

{
  "name": "nw-demo",
  "chromium-args": "--enable-features=GamepadExtensions",
  "main": "index.html"
}
@rogerwang

This comment has been minimized.

Copy link
Member

commented Apr 3, 2018

I should add that since it's shown "Default" in "chrome://flags", meaning it's default according to the source code and the code enabling this is hit when I use that manifest. That's what I mean by "should be enabled". It should be better with a test case that don't require a physical device.

@TheRealDannyyy

This comment has been minimized.

Copy link
Author

commented Apr 3, 2018

@rogerwang I found the issue, thanks for providing the manifest example!

This line inside my manifest file is causing the "GamepadExtensions" chromium arg to not work:
"user-agent": "Mozilla/5.0 (%osinfo) AppleWebKit/%webkit_ver (KHTML, like Gecko, Chrome, Safari)

Do you know why that's causing an error? All the other chromium args work fine, despite the user-agent.
(Below are both manifest files, one is working the other one is broken because of the user-agent.)

Download Manifest Files.zip

@rogerwang

This comment has been minimized.

Copy link
Member

commented Apr 3, 2018

Interesting. But your broken manifest works here.

@TheRealDannyyy

This comment has been minimized.

Copy link
Author

commented Apr 3, 2018

@rogerwang are you sure that it does?
It works with all chromium args except GamepadExtensions on my end.

@rogerwang

This comment has been minimized.

Copy link
Member

commented Apr 3, 2018

@TheRealDannyyy

This comment has been minimized.

Copy link
Author

commented Apr 3, 2018

@rogerwang I honestly have no clue why it would work on your end and not on mine. I'm pretty sure that the user agent is at fault on my end but I don't know what I could do about it.

Here is the project with the "broken" package file, feel free to take a look and test it. I don't know what to do next, besides waiting another year for the Chromium Dev's to finally make this feature available to everyone.

Thanks a lot for your help so far, hoping that you'll maybe find a good workaround.

@rogerwang

This comment has been minimized.

Copy link
Member

commented Apr 3, 2018

@TheRealDannyyy

This comment has been minimized.

Copy link
Author

commented Apr 3, 2018

Maybe the user agent change triggered some issue in your application...

I think so too but I have no idea how I could fix this or find out whats going wrong. The console is empty and the flag is even marked as "enabled" so there must be some hidden error going on in the background

@TheRealDannyyy TheRealDannyyy changed the title "--enable-gamepad-extensions" Js Flag Not Supported? "--enable-features=GamepadExtensions" Chromium Arg Doesn't Work With Certain User-Agents Apr 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.