Address review feedback
This commit is contained in:
@@ -182,8 +182,9 @@ test("switch cameras", async () => {
|
|||||||
async (vm) => {
|
async (vm) => {
|
||||||
// Switch to back camera
|
// Switch to back camera
|
||||||
getValue(vm.switchCamera$)!();
|
getValue(vm.switchCamera$)!();
|
||||||
expect(restartTrack).toHaveBeenCalledTimes(1);
|
expect(restartTrack).toHaveBeenCalledExactlyOnceWith({
|
||||||
expect(restartTrack).toHaveBeenCalledWith({ facingMode: "environment" });
|
facingMode: "environment",
|
||||||
|
});
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(selectVideoInput).toHaveBeenCalledTimes(1);
|
expect(selectVideoInput).toHaveBeenCalledTimes(1);
|
||||||
expect(selectVideoInput).toHaveBeenCalledWith("back camera");
|
expect(selectVideoInput).toHaveBeenCalledWith("back camera");
|
||||||
|
|||||||
@@ -456,11 +456,13 @@ export class LocalUserMediaViewModel extends BaseUserMediaViewModel {
|
|||||||
const track = v?.publication?.track;
|
const track = v?.publication?.track;
|
||||||
if (!(track instanceof LocalVideoTrack)) return of(null);
|
if (!(track instanceof LocalVideoTrack)) return of(null);
|
||||||
return merge(
|
return merge(
|
||||||
// Watch for track restarts because they indicate a camera switch
|
// Watch for track restarts because they indicate a camera switch.
|
||||||
|
// This event is also emitted when unmuting the track object.
|
||||||
fromEvent(track, TrackEvent.Restarted).pipe(
|
fromEvent(track, TrackEvent.Restarted).pipe(
|
||||||
startWith(null),
|
startWith(null),
|
||||||
map(() => track),
|
map(() => track),
|
||||||
),
|
),
|
||||||
|
// When the track object is muted, reset it to null.
|
||||||
fromEvent(track, TrackEvent.Muted).pipe(map(() => null)),
|
fromEvent(track, TrackEvent.Muted).pipe(map(() => null)),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user