Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Added ability to mute/unmute mic and enable it later than PixelStreaming creation time #192

Merged
merged 5 commits into from Sep 12, 2023

Conversation

kass-kass
Copy link
Contributor

Relevant components:

  • Signalling server
  • Frontend library
  • Frontend UI library
  • Matchmaker
  • Platform scripts
  • SFU

Problem statement:

Currently, if a microphone track is enabled at PixelStreaming instance creation time, there is no easily accessible way to mute the microphone stream.

Additionally, if the PixelStreaming instance is created without a mic track, there is no easy way to add one later.

Solution

This PR adds public funcitons to set the mic muted state.

The function to unmute the mic can be called with a forceEnable parameter, which allows to add a mic track at a later time (if one wasn't initially added), and trigger a full reconnect.

Documentation

252b958

Test Plan and Compatibility

Doesn't modify existing APIs, just adds new functions.

Note: some intenral functionality that was very verbose and hard-to-read is now encapsulated in a new RTCUtils class.

@@ -426,18 +422,16 @@ export class PeerConnectionController {
});
} else {
// set the audio options based on mic usage
const audioOptions = useMic
Copy link
Contributor Author

@kass-kass kass-kass Apr 7, 2023

Choose a reason for hiding this comment

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

To explain this change: the useMic ? check is extraneous, as this code is inside an if (!useMic) ... else { } scope.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch!

@Belchy06
Copy link
Collaborator

Looking good @kass-kass.

We're currently winding down active development of the master branch in preparation for the 5.2 launch, meaning we're only merging critical bug fixes.

We'll open back up to features once 5.2 has launched.

With that being said, I've got a small feature request to go with this PR. Could I get you to add a mic toggle in the top left corner (where fullscreen and panel buttons sit)? I think having it only be visible if the page is loaded with the useMic URLParam or if the Use Mic toggle is set, but once connected being able to click this button to trigger the pixelStreaming objects muteMicrophone and unmuteMicrophone functionality.

@lukehb lukehb added this to the 5.3 milestone Jun 6, 2023
@github-actions
Copy link
Contributor

PRs go stale after 30 days of inactivity. Please comment or re-open the PR if you are still working on this PR.

@mcottontensor
Copy link
Contributor

Is the extra functionality re. the microphone button coming? I have been looking at this PR and noticed the functionality was missing.

@lukehb
Copy link
Contributor

lukehb commented Aug 31, 2023

@mcottontensor I think we can assume not. You can add it if you think the effort is low enough, otherwise I am happy to merge without the added UI button.

@kass-kass
Copy link
Contributor Author

@lukehb @mcottontensor Haven't been able to find the time to add this yet, due to other workloads. Will likely take a look beginning of October to finish this up, does that sound OK?

@lukehb
Copy link
Contributor

lukehb commented Sep 11, 2023

@mcottontensor I think we can merge without the mic button - the lack of that button is not blocking and tbh I prefer the feature without it.

@mcottontensor mcottontensor merged commit 54eb5b7 into EpicGames:master Sep 12, 2023
1 check passed
@lukehb lukehb modified the milestones: 5.3, 5.4 Sep 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

4 participants