Skip to content

Voice and Video does not work in M1 nightly build (Discord) #213

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

Closed
BrianGilbert opened this issue Oct 7, 2021 · 28 comments
Closed

Voice and Video does not work in M1 nightly build (Discord) #213

BrianGilbert opened this issue Oct 7, 2021 · 28 comments
Labels
hacktoberfest help wanted Extra attention is needed

Comments

@BrianGilbert
Copy link

BrianGilbert commented Oct 7, 2021

Bug description:

Steps to reproduce:

  1. Open Security and Privacy
  2. Enable Camera access for Ferdi
  3. Enable Microphone access for Ferdi
  4. Open Ferdi
  5. Try and join a meeting room in Discord, you will be unable to
  6. open Discord preferences, no Voice and Video settings visible.

Expected behavior

Voice and Video should function

Screenshots

Ferdi - 2021-10-07 11-38-52
Ferdi - 2021-10-07 11-39-52

Environment:

  • Operating System: macOS Big Sur 11.6 (20G165)

  • Ferdi Version: 5.6.3-nightly.27

  • Server: Franz

  • Debug information:

{"host":{"platform":"darwin","release":"20.6.0","screens":[{"id":2,"bounds":{"x":0,"y":0,"width":5120,"height":1440},"workArea":{"x":0,"y":25,"width":5120,"height":1415},"accelerometerSupport":"unknown","monochrome":false,"colorDepth":24,"colorSpace":"{primaries_d50_referred: [[0.6976, 0.2952],  [0.2935, 0.6500],  [0.1536, 0.0616]], transfer:BT709_APPLE, matrix:RGB, range:FULL}","depthPerComponent":8,"size":{"width":5120,"height":1440},"displayFrequency":119,"workAreaSize":{"width":5120,"height":1415},"scaleFactor":1,"rotation":0,"internal":false,"touchSupport":"unknown"},{"id":1,"bounds":{"x":841,"y":-1080,"width":1920,"height":1080},"workArea":{"x":841,"y":-1055,"width":1920,"height":1055},"accelerometerSupport":"unknown","monochrome":false,"colorDepth":24,"colorSpace":"{primaries_d50_referred: [[0.6491, 0.3435],  [0.3194, 0.6268],  [0.1858, 0.1254]], transfer:0.0777*x + 0.0000 if x < 0.0450 else (0.9495*x + 0.0495)**2.3955 + 0.0003, matrix:RGB, range:FULL}","depthPerComponent":8,"size":{"width":1920,"height":1080},"displayFrequency":59,"workAreaSize":{"width":1920,"height":1055},"scaleFactor":1,"rotation":0,"internal":false,"touchSupport":"unknown"}]},"ferdi":{"version":"5.6.3-nightly.25","electron":"15.1.1","installedRecipes":[{"id":"clockify","version":"1.1.1"},{"id":"discord","version":"1.4.4"},{"id":"franz-custom-website","version":"1.1.0"},{"id":"hangouts","version":"1.2.1"},{"id":"messenger","version":"1.3.3"},{"id":"msteams","version":"3.1.6"},{"id":"rocketchat","version":"1.2.3"},{"id":"slack","version":"1.3.2"},{"id":"whatsapp","version":"3.3.5"},{}],"devRecipes":[],"services":[{"id":"6120e920-6f75-414e-9b2a-d4c0e1c4343d","recipe":"discord","isAttached":true,"isActive":true,"isEnabled":true,"isHibernating":false,"hasCrashed":false,"isDarkModeEnabled":false},{"id":"018282bb-8d55-497c-8eab-3d6455234ea0","recipe":"whatsapp","isAttached":true,"isActive":false,"isEnabled":true,"isHibernating":false,"hasCrashed":false,"isDarkModeEnabled":false},{"id":"a9cdbf93-6730-43df-a6d9-7e7d25b13abc","recipe":"slack","isAttached":true,"isActive":false,"isEnabled":true,"isHibernating":false,"hasCrashed":false,"isDarkModeEnabled":false},{"id":"b90e18b5-09a7-4fb9-8812-8e19329ded85","recipe":"slack","isAttached":true,"isActive":false,"isEnabled":true,"isHibernating":false,"hasCrashed":false,"isDarkModeEnabled":false},{"id":"f37efb5a-79b4-4058-aea8-813f49f80323","recipe":"messenger","isAttached":true,"isActive":false,"isEnabled":true,"isHibernating":false,"hasCrashed":false,"isDarkModeEnabled":false},{"id":"fd9b7416-d820-41ee-b209-8361e7664782","recipe":"rocketchat","isAttached":true,"isActive":false,"isEnabled":true,"isHibernating":false,"hasCrashed":false,"isDarkModeEnabled":false},{"id":"833c573d-9f16-4744-a46f-9f8c35b5c500","recipe":"hangouts","isAttached":false,"isActive":false,"isEnabled":false,"isHibernating":false,"hasCrashed":false,"isDarkModeEnabled":false},{"id":"4ef0fa9a-dd8e-4c13-a054-916cd65c6883","recipe":"franz-custom-website","isAttached":false,"isActive":false,"isEnabled":true,"isHibernating":true,"hasCrashed":false,"isDarkModeEnabled":false},{"id":"a3abff6a-4871-415d-91e5-a18961c1e875","recipe":"franz-custom-website","isAttached":false,"isActive":false,"isEnabled":true,"isHibernating":true,"hasCrashed":false,"isDarkModeEnabled":false},{"id":"ac4d854a-bd24-4462-b22d-3a981c10cf43","recipe":"franz-custom-website","isAttached":false,"isActive":false,"isEnabled":true,"isHibernating":true,"hasCrashed":false,"isDarkModeEnabled":false},{"id":"1177d964-ceec-4809-8248-51ec011ac193","recipe":"clockify","isAttached":false,"isActive":false,"isEnabled":false,"isHibernating":false,"hasCrashed":false,"isDarkModeEnabled":false}],"messages":[{"type":"error","info":["error","Warning: Failed prop type: Invalid prop `actions.service` of type `Object` supplied to `_class2`, expected instance of `_class`.\n    in _class2 (created by inject-_class2-with-stores-actions)\n    in inject-_class2-with-stores-actions (created by RouterContext)\n    in RouterContext (created by Router)\n    in Router (created by _class)\n    in _class (created by inject-_class-with-stores-actions)\n    in inject-_class-with-stores-actions\n    in IntlProvider (created by _class)\n    in _class (created by inject-_class-with-stores)\n    in inject-_class-with-stores\n    in Provider"]},{"type":"error","info":["error","Warning: Failed prop type: Invalid prop `actions.settings` of type `Object` supplied to `_class2`, expected instance of `_class`.\n    in _class2 (created by inject-_class2-with-stores-actions)\n    in inject-_class2-with-stores-actions (created by Context.Consumer)\n    in injectIntl(inject-_class2-with-stores-actions) (created by _class2)\n    in div (created by _class2)\n    in div (created by _class2)\n    in _class2 (created by Jss(_class2))\n    in Jss(_class2) (created by Context.Consumer)\n    in injectIntl(Jss(_class2)) (created by _class2)\n    in _class2 (created by Jss(_class2))\n    in Jss(_class2) (created by Context.Consumer)\n    in injectIntl(Jss(_class2)) (created by _class2)\n    in ThemeProvider (created by _class2)\n    in _class2 (created by inject-_class2-with-stores-actions)\n    in inject-_class2-with-stores-actions (created by RouterContext)\n    in RouterContext (created by Router)\n    in Router (created by _class)\n    in _class (created by inject-_class-with-stores-actions)\n    in inject-_class-with-stores-actions\n    in IntlProvider (created by _class)\n    in _class (created by inject-_class-with-stores)\n    in inject-_class-with-stores\n    in Provider"]},{"type":"error","info":["error","Warning: Failed prop type: Invalid prop `actions.settings` of type `Object` supplied to `_class`, expected instance of `_class`.\n    in _class (created by inject-_class-with-stores-actions)\n    in inject-_class-with-stores-actions (created by Jss(inject-_class-with-stores-actions))\n    in Jss(inject-_class-with-stores-actions) (created by Context.Consumer)\n    in injectIntl(Jss(inject-_class-with-stores-actions)) (created by _class2)\n    in div (created by _class2)\n    in div (created by _class2)\n    in div (created by _class2)\n    in _class2 (created by Jss(_class2))\n    in Jss(_class2) (created by Context.Consumer)\n    in injectIntl(Jss(_class2)) (created by _class2)\n    in _class2 (created by Jss(_class2))\n    in Jss(_class2) (created by Context.Consumer)\n    in injectIntl(Jss(_class2)) (created by _class2)\n    in ThemeProvider (created by _class2)\n    in _class2 (created by inject-_class2-with-stores-actions)\n    in inject-_class2-with-stores-actions (created by RouterContext)\n    in RouterContext (created by Router)\n    in Router (created by _class)\n    in _class (created by inject-_class-with-stores-actions)\n    in inject-_class-with-stores-actions\n    in IntlProvider (created by _class)\n    in _class (created by inject-_class-with-stores)\n    in inject-_class-with-stores\n    in Provider"]},{"type":"error","request":{"result":null,"wasExecuted":true,"method":"getInfo"},"error":{},"response":{},"server":"https://api.franzinfra.com"},{"type":"error","request":{"result":null,"wasExecuted":true,"method":"features"},"error":{},"response":{},"server":"https://api.franzinfra.com"},{"type":"error","request":{"result":null,"wasExecuted":true,"method":"all"},"error":{},"response":{},"server":"https://api.franzinfra.com"},{"type":"error","info":["error",{}]}],"workspaces":[{"id":"9c51c66c-fdaf-444e-93b1-9a8f2dfb0049","services":["6120e920-6f75-414e-9b2a-d4c0e1c4343d","a9cdbf93-6730-43df-a6d9-7e7d25b13abc","b90e18b5-09a7-4fb9-8812-8e19329ded85","fd9b7416-d820-41ee-b209-8361e7664782"]},{"id":"3829efed-cd77-45ea-b2af-6775be4e929d","services":["6120e920-6f75-414e-9b2a-d4c0e1c4343d","f37efb5a-79b4-4058-aea8-813f49f80323"]}],"windowSettings":{"width":1880,"height":1046,"x":845,"y":-1052,"displayBounds":{"x":841,"y":-1080,"width":1920,"height":1080},"isMaximized":false,"isFullScreen":false},"settings":{"autoLaunchInBackground":false,"runInBackground":true,"reloadAfterResume":true,"enableSystemTray":true,"startMinimized":false,"confirmOnQuit":false,"minimizeToSystemTray":false,"closeToSystemTray":false,"privateNotifications":false,"clipboardNotifications":true,"notifyTaskBarOnMessage":false,"showDisabledServices":true,"showMessageBadgeWhenMuted":true,"showDragArea":false,"enableSpellchecking":true,"spellcheckerLanguage":"en-us","darkMode":false,"splitMode":false,"locale":"en-US","fallbackLocale":"en-US","beta":true,"isAppMuted":false,"enableGPUAcceleration":true,"server":"https://api.franzinfra.com","predefinedTodoServer":"https://app.franztodos.com","autohideMenuBar":false,"lockingFeatureEnabled":false,"locked":false,"lockedPassword":"******","useTouchIdToUnlock":true,"scheduledDNDEnabled":false,"scheduledDNDStart":"17:00","scheduledDNDEnd":"09:00","hibernateOnStartup":true,"hibernationStrategy":"300","wakeUpStrategy":"300","inactivityLock":0,"automaticUpdates":true,"universalDarkMode":true,"userAgentPref":"","adaptableDarkMode":true,"accentColor":"#7266F0","serviceRibbonWidth":68,"iconSize":20,"sentry":false,"nightly":false,"navigationBarBehaviour":"custom","searchEngine":"duckDuckGo","useVerticalStyle":false,"alwaysShowWorkspaces":false,"liftSingleInstanceLock":false},"features":{"isServiceProxyEnabled":true,"isWorkspaceEnabled":true,"isTodosEnabled":true,"isSettingsWSEnabled":false},"user":"a0aa0b7a-ee62-494c-aa94-c753fda4a42e"}}
@BrianGilbert
Copy link
Author

PS: This problem is not present on the intel mac build

@BrianGilbert
Copy link
Author

BrianGilbert commented Oct 8, 2021

confirmed still a problem on M1 with 5.6.3-nightly.27

@vraravam vraravam added hacktoberfest help wanted Extra attention is needed labels Oct 9, 2021
@vraravam
Copy link

vraravam commented Oct 9, 2021

@BrianGilbert - there is no code for this feature to differentiate between the ARM vs the x86 builds (unless there's something being added/removed while the app is being packaged by electron-builder).

Did you try overriding the user-agent from the x86 machine for the service when using on the M1? Maybe this is a differentiation being done on the service's server-side?

@BrianGilbert
Copy link
Author

@vraravam I've not overridden anything, I just installed Ferdi and logged in via my Franz account (same as I have done on intel mac)

@BrianGilbert
Copy link
Author

BrianGilbert commented Oct 12, 2021

If I click either of the mic/headphone icon in https://user-images.githubusercontent.com/114017/136302510-457f4bdf-4a1e-4838-a89a-b840327d4314.png

I get the following error
Ferdi - 2021-10-12 14-25-32

I tried setting the user agent in Ferdi advanced settings to both the following but it hasn't helped (I did restart Ferdi)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:95.0) Gecko/20100101 Firefox/95.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36 Edg/94.0.992.47

I also created a custom website within Ferdi pointing to https://wtools.io/check-my-user-agent and confirmed that the user agent is being sent correctly... it is.

The default agent on M1 install of Ferdi before I edited it was:
Mozilla/5.0 (Macintosh; Apple Mac OS X 11_6_0) AppleWebKit/537.36.0 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36.0

The agent on my intel mac install of Ferdi is identical:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_6_0) AppleWebKit/537.36.0 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36.0

@BrianGilbert
Copy link
Author

BrianGilbert commented Oct 13, 2021

Still an issue with Version: 5.6.3-nightly.32 and 5.6.3-nightly.33

@BrianGilbert
Copy link
Author

@vraravam I'd be more than happy to try and interactively debug this if you'd like to schedule a suitable time? I'm in Melbourne, Australia, GMT+11

@vraravam
Copy link

@BrianGilbert - thanks, but, right now, its too tight for me with my day job and some upcoming travel starting tomorrow. Also, I do not use Discord, and so debugging this might not be possible if I am the other person.

I will defer to either @mhatvan or @kris7t who might be closer to your timezone.

@vraravam
Copy link

If you were referring to setting up Ferdi for development on your machine, and then debug it, I would suggest to start with the CONTRIBuTING.md file - that is complete and up-to-date afaik.

@kevindement
Copy link

kevindement commented Oct 17, 2021

This issue is present for me as well, on the current nightly build (5.6.3-nightly.37) as well as the current stable build (5.6.2). I'm running the latest Monterey beta.

@BrianGilbert
Copy link
Author

BrianGilbert commented Oct 17, 2021

Just tested, still present in 5.6.3-nightly.3637

@BrianGilbert
Copy link
Author

This issue is present for me as well, on the current nightly build as well as the current stable build. I'm running the latest Monterey beta.

at least I know I'm not the only person experiencing this now

@kevindement
Copy link

I'd be happy to assist with debugging as well if it would be helpful. I'm on New York time (EDT, GMT-4)

@kevindement
Copy link

kevindement commented Oct 19, 2021

After doing some digging, it looks like the issue is related to the user agent. I pulled the user agent string from the current Mac version of Discord and changed it in the index.js file for the Discord recipe, and now voice and audio work, but video and screen sharing still do not.

User agent I got from Discord:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.264 Chrome/91.0.4472.164 Electron/13.4.0 Safari/537.36

Note that using the User Agent override in settings did not seem to have an effect, but changing it at the recipe level did.

@BrianGilbert
Copy link
Author

BrianGilbert commented Oct 20, 2021

After doing some digging, it looks like the issue is related to the user agent. I pulled the user agent string from the current Mac version of Discord and changed it in the index.js file for the Discord recipe, and now voice and audio work, but video and screen sharing still do not.

User agent I got from Discord: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.264 Chrome/91.0.4472.164 Electron/13.4.0 Safari/537.36

Note that using the User Agent override in settings did not seem to have an effect, but changing it at the recipe level did.

@kevindement is that something I can test with the installed application, or is is a pre-compilation thing?

@kevindement
Copy link

kevindement commented Oct 20, 2021

@kevindement is that something I test do with the installed application, or is is a pre-compilation thing?

Pre-compilation, I made the change in this file (just by returning the whole string for testing purposes) and recompiled

@BrianGilbert
Copy link
Author

@kevindement will there be a build with the change soon? I'm hoping it may also resolve #191

@kevindement
Copy link

I'd be hesitant to make that change myself without knowing if there's perhaps a proper user agent that would enable video and screen sharing (and without knowing if forcing this one would break those things for other platforms)

@BrianGilbert
Copy link
Author

@kevindement I can't find any instructions on building ferdi myself? I tried editing the recipe file locally in ~/Library/Application Support/Ferdi/recipes but that didn't work

@kevindement
Copy link

@kevindement I can't find any instructions on building ferdi myself? I tried editing the recipe file locally in ~/Library/Application Support/Ferdi/recipes but that didn't work

@BrianGilbert I used the instructions here to get it set up, using Homebrew to grab the right version of node (brew install node@14 && brew link node@14)

@BrianGilbert
Copy link
Author

BrianGilbert commented Oct 20, 2021

so I can edit the file, but an update gets downloaded on launch, it did however fix both the issues I've raised, at least until the service got updated again

module.exports = Ferdi => class Discord extends Ferdi {
  overrideUserAgent() {
    const useragent = window.navigator.userAgent;
    const parts = useragent.split('(KHTML, like Gecko)');

    return 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.264 Chrome/91.0.4472.164 Electron/13.4.0 Safari/537.36';
  }
};

This seems to be holding after several executions of Ferdi now

@BrianGilbert
Copy link
Author

@vraravam FYI ☝️

@kevindement
Copy link

The thing I'm really confused about is why this only affects M1 Macs -- the current approach seems to work everywhere else.

@BrianGilbert
Copy link
Author

@kevindement I still am unable to share video or screen though, we need to figure out the right user agent I'm guessing
Ferdi - Discord 2021-10-21 10-23-24

@BrianGilbert
Copy link
Author

BrianGilbert commented Oct 20, 2021

@kevindement this worked for me to get video and screen sharing ~/Library/Application Support/Ferdi/recipes/discord/index.js:

module.exports = Ferdi => class Discord extends Ferdi {
  overrideUserAgent() {
    const useragent = window.navigator.userAgent;
    const parts = useragent.split('(KHTML, like Gecko)');

    return 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0';
  }
};

@BrianGilbert
Copy link
Author

BrianGilbert commented Oct 21, 2021

@kevindement a simpler way to resolve it (does not require editing the recipe file):

  • Right click on Discord service
  • Select edit
  • Scroll to bottom of Discord service settings
  • Paste the following into the User Agent field
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0
  • Save Service
  • Refresh discord service by pressing Cmd+R

@vraravam
Copy link

For future reference, the Intel in the above user-agent string tricks discord to think of the current hardware as non-M1, and so this works. I don't think Ferdi can do anything more than spoofing the user-agent. Discord will have to make changes on their side to allow voice/video/screensharing with ARM-based hardware.

@vraravam
Copy link

Please close this ticket (and the other linked one) if this is acceptable.

@ghost ghost transferred this issue from another repository Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants