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

room name and user name as GET parameters #95

Closed

Conversation

leesalminen
Copy link

@leesalminen leesalminen commented Mar 18, 2020

This feature allows users to pass in the room name and user name as GET parameters to the application. This enables <iframe> embeds as well as easier link sharing to get multiple participants into the same room.

Example URL: https://video-app-XXXX-dev.twil.io/?passcode=NNNNNNNNN&room=my-room&user=admin

I know that the room name can be passed in via URL route, however this does not work when deployed to Twilio Functions API infrastructure.

Contributing to Twilio

All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.

  • I acknowledge that all my contributions will be made under the project's license.

Burndown

Before review

  • Updated CHANGELOG.md if necessary
  • Added unit tests if necessary
  • Updated affected documentation
  • Verified locally with npm test
  • Manually sanity tested running locally
  • Included screenshot as PR comment (if needed)
  • Ready for review

Before merge

  • Got one or more +1s
  • Re-tested if necessary

@aaalaniz aaalaniz requested review from timmydoza and charliesantos and removed request for timmydoza March 18, 2020 18:21
Copy link
Collaborator

@charliesantos charliesantos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great addition @leesalminen ! Thank you for submitting. I left a few comments/questions.
Can you also please write tests for your changes? Thanks!

@@ -23,6 +23,7 @@
"lint-staged": "^9.5.0",
"lodash.throttle": "^4.1.1",
"prettier": "^1.19.1",
"query-string": "^6.11.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should've updated the package-lock.json. Can you please push up the changes?

@@ -1,9 +1,22 @@
import { useCallback, useEffect, useState } from 'react';
import { useHistory } from 'react-router-dom';
const queryString = require('query-string');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use import here?

const parsed = queryString.parse(window.location.search);
const user = parsed.user ? parsed.user : window.sessionStorage.getItem('user');
return user;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are sharing this url, I would expect we want the user to enter their own username. Why are we setting it in the url? Can you please provide the use case for this?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@charliesantos there are a few use-cases where prefilling a user's name could be useful.

For example, I click a button to send an SMS link to the video room. The button trigger's a controller that queries by DB based on the phone entered and pulls the first name based on the phone number. Then, the controller adds that param to the link and sends an SMS -> user has a one-click join experience.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good use case @cweems. In that case, I think we can keep this feature in this PR.

@leesalminen
Copy link
Author

leesalminen commented Mar 20, 2020 via email

@saulm
Copy link

saulm commented Mar 28, 2020

This feature (passing user/room) as coded in this PR doesn't work if you don't use passcode auth correct?

@saulm
Copy link

saulm commented Mar 30, 2020

Heads up, based on my testing locally of this feature, using auto connect in Safari will break the Audio (No audio track)

@cweems
Copy link

cweems commented Apr 14, 2020

@leesalminen @saulm I made a PR on top of Lee's that adds the ability to accept URL params without passcode auth: leesalminen#1

I was also able to reproduce the Safari issue, but I don't understand what's causing it. Is there some Safari specific behavior that prevents audio and video access without a form submit?

@timmydoza
Copy link
Contributor

Thanks for the PR @leesalminen

Some thoughts:

  1. It looks like this feature only works when the app is set to use passcode authentication. I think it could be useful if this feature was always available, even when the app is set to use a different (or no) auth method.

  2. This feature has the user join a room instantly when the room and user parameters are present. As some other users have pointed out, this can cause some problems with audio. Browsers have an autoplay policy which requires a user interaction (such as clicking on the page) before audio elements can start to play sound. When a users joins a room immediately, audio elements are added to the DOM before there has been any user interaction, and thus no sound can be heard.
    An additional problem is that the user joins a room before they have granted permissions to the app to use their microphone and camera. This means that they join a room without publishing any audio or video to the room. Once they are in the room and grant access to their mic and camera, the app doesn't know to then publish those tracks to the room. This app assumes that it will have access to the user's mic and camera before the user clicks the 'Join Room' button, so we'd have to update some logic in the app to handle this auto-join scenario.

To summarize, I think it's fine to populate the user's name and room name via query parameters, but I don't think it's a good idea to add the auto-join feature. @leesalminen, would this PR still meet your use case if the auto-join feature is removed?

@RusseII
Copy link

RusseII commented Apr 17, 2020

To summarize, I think it's fine to populate the user's name and room name via query parameters, but I don't think it's a good idea to add the auto-join feature. @leesalminen, would this PR still meet your use case if the auto-join feature is removed?

I'm not sure about for @leesalminen but I can comment on my use case. We have a similar situation where we are creating a shareable link for job-seekers to join a two way interview. We already have the job seekers name, so it's nice being able to prepopulate that for them.

I actually prefer still having some sort of preview room so they can make sure everything looks nice and is working before joining the interview.

@imjared
Copy link

imjared commented Apr 17, 2020

In our use case, we found it was sufficient enough to have users join the "waiting room" with standard GET parameters:

image

This saves us from the issues @timmydoza mentioned above, namely the browser's requirement for user interaction before <audio> is triggered

@timmydoza
Copy link
Contributor

I think the uses cases that @RusseII and @imjared explain are good ones. I agree with having a 'waiting room' or a 'preview room'.

I can go ahead and wrap up this PR to implement the feature. One question that I have: If the user's identity and room name are supplied with query parameters, then should the 'Name' and 'Room' text fields still be editable by the user?

@imjared
Copy link

imjared commented Apr 23, 2020

I can go ahead and wrap up this PR to implement the feature. One question that I have: If the user's identity and room name are supplied with query parameters, then should the 'Name' and 'Room' text fields still be editable by the user?

Good question. For our use case, I left them editable though I don't know why a user would want to edit them and I could certainly see a use case where the provider might want to obscure that functionality with something like simply having a "ready to join?" button.

@RusseII
Copy link

RusseII commented Apr 23, 2020 via email

URLRoomName = window.sessionStorage.getItem('room') || '';
}

const URLUserName = window.sessionStorage.getItem('user') || '';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this come from useParams() the same way that URLRoomName does?

@timmydoza
Copy link
Contributor

Thanks for the discussion @RusseII, @imjared!

Given that each use case may vary a little bit, is seems that it may be tricky to implement a one-size-fits-all solution. It also sounds like a simple feature to implement, and that you both have already done so. Given all this, (in addition to the fact that we haven't heard from the original author @leesalminen in a while) I'm leaning towards closing this PR. Any objections?

@imjared
Copy link

imjared commented Apr 29, 2020

@timmydoza honestly you all have made this thing so easy to customize that i think it's fine if it's left to the user to add the ?room_name= functionality.

took me all of like 10 mins after cloning to figure out how to run it and start making changes

@timmydoza
Copy link
Contributor

Sounds good @imjared! I appreciate the feedback! I'll close this PR then.

@timmydoza timmydoza closed this May 1, 2020
@RusseII
Copy link

RusseII commented May 1, 2020

@timmydoza I'm a bit late to the party but I agree with everything @imjared said

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants