Fix muting local media stream in chrome
This commit is contained in:
parent
7412fdd93e
commit
e040833737
2 changed files with 18 additions and 4 deletions
|
|
@ -169,6 +169,7 @@ export class ConferenceCallManager extends EventEmitter {
|
||||||
// that has entered the call.
|
// that has entered the call.
|
||||||
this.participants = [];
|
this.participants = [];
|
||||||
|
|
||||||
|
this.localVideoStream = null;
|
||||||
this.localParticipant = null;
|
this.localParticipant = null;
|
||||||
|
|
||||||
this.micMuted = false;
|
this.micMuted = false;
|
||||||
|
|
@ -226,7 +227,7 @@ export class ConferenceCallManager extends EventEmitter {
|
||||||
|
|
||||||
// Request permissions and get the user's webcam/mic stream if we haven't yet.
|
// Request permissions and get the user's webcam/mic stream if we haven't yet.
|
||||||
const userId = this.client.getUserId();
|
const userId = this.client.getUserId();
|
||||||
const stream = await this.client.getLocalVideoStream();
|
const stream = await this.getLocalVideoStream();
|
||||||
|
|
||||||
// It's possible to navigate to another page while the microphone permission prompt is
|
// It's possible to navigate to another page while the microphone permission prompt is
|
||||||
// open, so check to see if we've left the call.
|
// open, so check to see if we've left the call.
|
||||||
|
|
@ -303,6 +304,7 @@ export class ConferenceCallManager extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.client.stopLocalMediaStream();
|
this.client.stopLocalMediaStream();
|
||||||
|
this.localVideoStream = null;
|
||||||
|
|
||||||
this.room = null;
|
this.room = null;
|
||||||
this.entered = false;
|
this.entered = false;
|
||||||
|
|
@ -318,10 +320,22 @@ export class ConferenceCallManager extends EventEmitter {
|
||||||
this.emit("left");
|
this.emit("left");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getLocalVideoStream() {
|
||||||
|
if (this.localVideoStream) {
|
||||||
|
return this.localVideoStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
const stream = await this.client.getLocalVideoStream();
|
||||||
|
|
||||||
|
this.localVideoStream = stream;
|
||||||
|
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
setMicMuted(muted) {
|
setMicMuted(muted) {
|
||||||
this.micMuted = muted;
|
this.micMuted = muted;
|
||||||
|
|
||||||
const localStream = this.client.localAVStream;
|
const localStream = this.localVideoStream;
|
||||||
|
|
||||||
if (localStream) {
|
if (localStream) {
|
||||||
for (const track of localStream.getTracks()) {
|
for (const track of localStream.getTracks()) {
|
||||||
|
|
@ -347,7 +361,7 @@ export class ConferenceCallManager extends EventEmitter {
|
||||||
setVideoMuted(muted) {
|
setVideoMuted(muted) {
|
||||||
this.videoMuted = muted;
|
this.videoMuted = muted;
|
||||||
|
|
||||||
const localStream = this.client.localAVStream;
|
const localStream = this.localVideoStream;
|
||||||
|
|
||||||
if (localStream) {
|
if (localStream) {
|
||||||
for (const track of localStream.getTracks()) {
|
for (const track of localStream.getTracks()) {
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ function JoinRoom({
|
||||||
const [needsPermissions, setNeedsPermissions] = useState(false);
|
const [needsPermissions, setNeedsPermissions] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
manager.client
|
manager
|
||||||
.getLocalVideoStream()
|
.getLocalVideoStream()
|
||||||
.then((stream) => {
|
.then((stream) => {
|
||||||
if (videoRef.current) {
|
if (videoRef.current) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue