Johni0702 / mumble-web

An HTML5 Mumble client
671 stars 152 forks source link

Fails to capture voice as Riot Web widget #58

Open jellykells opened 4 years ago

jellykells commented 4 years ago

I have a Matrix Synapse server using Matrix Dimension as its integration manager.

I followed the instructions at https://github.com/Johni0702/mumble-web#matrix-widget to create a widget of my mumble-web installation. After entering the server password my voice is not captured and I see the following error in the console:

Uncaught TypeError: Failed to execute 'createMediaStreamSource' on 'AudioContext': parameter 1 is not of type 'MediaStream'.
    at module.exports (index.js:52735)
    at new VADVoiceHandler (index.js:49371)
    at GlobalBindings._updateVoiceHandler (index.js:887)
    at index.js:595
    at tryCallOne (index.js:26696)
    at index.js:26782
    at MutationObserver.flush (index.js:26930)
module.exports | @ | index.js:52735
-- | -- | --
  | VADVoiceHandler | @ | index.js:49371
  | GlobalBindings._updateVoiceHandler | @ | index.js:887
  | (anonymous) | @ | index.js:595
  | tryCallOne | @ | index.js:26696
  | (anonymous) | @ | index.js:26782
  | flush | @ | index.js:26930
  | setTimeout (async) |   |  
  | (anonymous) | @ | index.js:27117
  | tryCallOne | @ | index.js:26696
  | (anonymous) | @ | index.js:26782
  | flush | @ | index.js:26930
  | characterData (async) |   |  
  | requestCall | @ | index.js:27025
  | rawAsap | @ | index.js:26894
  | handleResolved | @ | index.js:26772
  | handle | @ | index.js:26768
  | finale | @ | index.js:26834
  | resolve | @ | index.js:26821
  | (anonymous) | @ | index.js:26862
  | _onMessage | @ | index.js:30909

If I click on the settings icon I see the following similar but different error:

index.js:52735 Uncaught TypeError: Failed to execute 'createMediaStreamSource' on 'AudioContext': parameter 1 is not of type 'MediaStream'.
    at module.exports (index.js:52735)
    at new VADVoiceHandler (index.js:49371)
    at SettingsDialog._setupTestVad (index.js:344)
    at new SettingsDialog (index.js:328)
    at GlobalBindings.openSettings (index.js:495)
    at HTMLImageElement.<anonymous> (index.js:47308)
  | module.exports | @ | index.js:52735
-- | -- | -- | --
  | VADVoiceHandler | @ | index.js:49371
  | _setupTestVad | @ | index.js:344
  | SettingsDialog | @ | index.js:328
  | GlobalBindings.openSettings | @ | index.js:495
  | (anonymous) | @ | index.js:47308

Browser: Vivaldi/2.9.1705.41 (Chrome/78.0.3904.99) Mumble-web: 0.5.1 Murmur: 1.3.0 Riot Web: 1.4.0-1.5.3 Matrix Dimension: v1.0.0

Johni0702 commented 4 years ago

Matrix' widget API used to be a bit lacking (especially wrt to formal specification) when I wrote those instructions. Basically, mumble-web used to pretend to be a Jitsi widget, so Riot would grant it permissions for staying always on screen (https://github.com/matrix-org/matrix-doc/issues/1354) even if you switch to a different chat. IIRC pretending to be Jitsi was also the only way to be granted access to the microphone.

I wouldn't be surprised if this no longer works (it was never formally specified anyway). It might also have never worked with Dimension in the first place (I never tried).

I'd suggest you ask in riot-web and/or dimension's room whether above workaround should still be functional and if it shouldn't, how to get around that (from a quick look at https://github.com/matrix-org/matrix-doc/issues/1236, I don't see anything that's changed).

jellykells commented 4 years ago

I noticed that the mumble-web widget never requests permission to access my mic. Is that relevant?

Johni0702 commented 4 years ago

IIRC riot-web adds a flag to all widgets (except jitsi) which automatically denies any mic access. Dunno if it still does that, it's been some time since I looked at it, but that'd explain what you're seeing.

jellykells commented 4 years ago

Unless that flag is separate from and overrides the iframe attributes, it would seem that microphone access is allowed.

allow="microphone; camera; encrypted-media; autoplay;"

sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-presentation"

jellykells commented 4 years ago

I tried adding an actual Jitsi widget and it doesn't request permissions either. Thinking it may be a Dimension issue.

jellykells commented 4 years ago

Regarding mic permissions, Firefox requests them correctly.

However, Firefox then fails to make a wss:// connection 🙃