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

Grid mode use sdk v3 #677

Draft
wants to merge 53 commits into
base: master
Choose a base branch
from
Draft

Grid mode use sdk v3 #677

wants to merge 53 commits into from

Conversation

timmydoza
Copy link
Contributor

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.

Pull Request Details

JIRA link(s):

Description

A description of what this PR does.

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

timmydoza added 7 commits March 8, 2022 13:16
* Install storybook and add basic files

* Get storybook working

* Get grid view working

* Hook up menu button

* Fix some issues

* Fix index.html caching issue

* Update publication component and tests

* Update Room tests

* Update constants

* Upgrade typescript

* Update menu tests

* Update TS things for new version

* Rename state variable

* Add test for ParticipantAudioTracks

* Remove unused passcode stuff from twilio mock

* Automatically disable conversations in storybook

* Fix tests and linting issues

* Add tests for GridView

* Fix participant issue in stories

* Add comment for ParticipantAudioTracks

* Remove unnecessary code
* Install storybook and add basic files

* Get storybook working

* Get grid view working

* Hook up menu button

* Fix some issues

* Fix index.html caching issue

* Update publication component and tests

* Update Room tests

* Update constants

* Upgrade typescript

* Update menu tests

* Update TS things for new version

* Rename state variable

* Add test for ParticipantAudioTracks

* Remove unused passcode stuff from twilio mock

* Automatically disable conversations in storybook

* Fix tests and linting issues

* Add tests for GridView

* Install mui pagination component

* Fix issue with storybook controls

* Add pagination controls to state

* Create usePagination hook

* Add pagination to GridView component

* Add setting for MaxGridParticipants

* Remove unused constant and fix a few glitches

* Add tests for usePagination

* Update tests for GridView component

* Fix linting issue

* Only render Pagination component when there is more than one page

* Display participant count in menu

* Fix tests

* remove console log

* Fix linter errors

* Fix test language

* Fix issue with chat window rendering incorrectly
@timmydoza timmydoza marked this pull request as draft May 11, 2022 22:07
Copy link
Collaborator

@manjeshbhargav manjeshbhargav left a comment

Choose a reason for hiding this comment

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

Apart from the suggested changes, we also need to handle audio tracks being switched off by disabling the audio level indicator and changing the mic icon.

@@ -7,16 +7,22 @@ export default function useIsTrackEnabled(track: TrackType) {
const [isEnabled, setIsEnabled] = useState(track ? track.isEnabled : false);

useEffect(() => {
setIsEnabled(track ? track.isEnabled : false);
// @ts-ignore
setIsEnabled(track?.mediaStreamTrack === null || track?.switchOffReason !== 'DisabledByPublisher');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
setIsEnabled(track?.mediaStreamTrack === null || track?.switchOffReason !== 'DisabledByPublisher');
setIsEnabled(track?.switchOffReason !== Track.DISABLED_BY_PUBLISHER);

track.on('disabled', setDisabled);
const handleSwitchOff = (_track: TrackType) => {
// @ts-ignore
if (_track.switchOffReason === 'DisabledByPublisher') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (_track.switchOffReason === 'DisabledByPublisher') {
if (_track.switchOffReason === Track.DISABLED_BY_PUBLISHER) {

@timmydoza
Copy link
Contributor Author

Thanks @manjeshbhargav!

I've updated the branch to use the correct string for 'disabled-by-publisher'. I wasn't able to use the enum from Track.SwitchOffReason because it isn't accessible. I think we need to export the enum on line 8 here. You can see the effect of exporting the enum in this TypeScript Playground example.

Also, for this:

we also need to handle audio tracks being switched off by disabling the audio level indicator and changing the mic icon

I think this will already be handled by the changes to the useIsEnabled hook, as this is what determines when we show the muted icon. Unless, do you mean that we should show the muted icon for switchoff reasons other than 'disabled-by-publisher'?

@manjeshbhargav
Copy link
Collaborator

Thanks @manjeshbhargav!

I've updated the branch to use the correct string for 'disabled-by-publisher'. I wasn't able to use the enum from Track.SwitchOffReason because it isn't accessible. I think we need to export the enum on line 8 here. You can see the effect of exporting the enum in this TypeScript Playground example.

Also, for this:

we also need to handle audio tracks being switched off by disabling the audio level indicator and changing the mic icon

I think this will already be handled by the changes to the useIsEnabled hook, as this is what determines when we show the muted icon. Unless, do you mean that we should show the muted icon for switchoff reasons other than 'disabled-by-publisher'?

@timmydoza We need to handle other switch off reasons as well. Either we can re-use the mic disabled icon, or we can use another icon to help us differentiate between disabled and switched off.

Copy link
Collaborator

@manjeshbhargav manjeshbhargav left a comment

Choose a reason for hiding this comment

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

The changes look good. I think we still need to add UI notification for switched off audio tracks (apart from disabled by publisher).

Comment on lines 14 to 20
const handleSwitchOff = (_track: TrackType) => {
// @ts-ignore
if (_track.switchOffReason === 'disabled-by-publisher') {
setIsEnabled(false);
}
};
const handleSwitchOn = () => setIsEnabled(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't this be:

Suggested change
const handleSwitchOff = (_track: TrackType) => {
// @ts-ignore
if (_track.switchOffReason === 'disabled-by-publisher') {
setIsEnabled(false);
}
};
const handleSwitchOn = () => setIsEnabled(true);
const handleSwitchOff = (_track: TrackType) => {
// @ts-ignore
setIsEnabled(_track.switchOffReason !== 'disabled-by-publisher');
};
const handleSwitchOn = () => setIsEnabled(true);

Base automatically changed from feature/grid-mode to master July 6, 2022 16:34
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

3 participants