Watts-Lab / deliberation-empirica

Empirica V2 framework
MIT License
5 stars 0 forks source link

Fix Daily default device on reload #375

Open JamesPHoughton opened 1 year ago

JamesPHoughton commented 1 year ago

When in the discussion a participant refreshes the page, the daily device selections from the previous page load are not persisted (for at least one person in a demo game).

Need to double check that persistence.

@Alan-Qiao - tagging you for situational awareness, I'll get more details to help with the debugging. This can happen after exams. ;)

JamesPHoughton commented 1 year ago

Not sure if the daily prebuilt can take a value for the hardware setup.

Alan-Qiao commented 1 year ago

Testing suggests daily PreBuilt failing to take Device ID for hardware setup on room connection. (I've previous asked the Daily team about this but got mixed responses. One suggested Device ID should work, though documentation says it will not)

I can think of two workarounds:

  1. Make Custom UI that looks exactly like prebuilt, but now I get the extra control needed to pass devices (Will look best, but may take longer than expected to replicate)
  2. Kind of ugly, but upon joining the room successfully, call setInputDeviceAsync() to change the devices to the saved ones (There will likely be a switch lag and some craziness)
JamesPHoughton commented 1 year ago

Couple questions:

JamesPHoughton commented 1 year ago

Decided to go with your option 2 above

JamesPHoughton commented 1 year ago

This should be working, we just need to check it using a cypress test. This may require mocking a webcam resource. If we can't do that, we'll do some "real people testing".

Could add some checkboxes to the QC survey: "I had problems with my: - webcam - speakers - microphone" etc.

Alan-Qiao commented 1 year ago

https://github.com/Watts-Lab/deliberation-empirica/pull/500

JamesPHoughton commented 1 year ago

Need to check that this also works for audio

JamesPHoughton commented 10 months ago

Bringing alan's code into main manually, as it's been so long.

Daily callFrame.join method takes properties but the relevant properties (videoSource and audioSource) arent supported in the daily prebuilt:

Image

As a result, alan 'resets' the video and audio sources after join to be the same as the ones selected in the initial view:

  callFrame.on("joined-meeting", (event) => {
      ...
      // Temporary Fix: Manually set devices to saved config on join
      setTimeout(() => {
        console.log("attempt switching device setting")
        callFrame.setInputDevicesAsync({
          videoDeviceId: player.get("camera"),
          audioDeviceId: player.get("mic"),
        })}
      , 5000);