Skip to content

Commit 566c304

Browse files
authored
Pass facingMode to initial getUserMedia call in track restart (#1451)
1 parent 615eb71 commit 566c304

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/olive-numbers-sing.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"livekit-client": patch
3+
---
4+
5+
Pass facingMode to initial getUserMedia call in track restart

src/room/track/LocalTrack.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export default abstract class LocalTrack<
314314
if (!constraints) {
315315
constraints = this._constraints;
316316
}
317-
const { deviceId, ...otherConstraints } = constraints;
317+
const { deviceId, facingMode, ...otherConstraints } = constraints;
318318
this.log.debug('restarting track with constraints', { ...this.logContext, constraints });
319319

320320
const streamConstraints: MediaStreamConstraints = {
@@ -323,7 +323,7 @@ export default abstract class LocalTrack<
323323
};
324324

325325
if (this.kind === Track.Kind.Video) {
326-
streamConstraints.video = deviceId ? { deviceId } : true;
326+
streamConstraints.video = deviceId || facingMode ? { deviceId, facingMode } : true;
327327
} else {
328328
streamConstraints.audio = deviceId ? { deviceId } : true;
329329
}

0 commit comments

Comments
 (0)