mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-02 19:49:23 +00:00
Update calleventaudiorenderer
This commit is contained in:
@@ -199,3 +199,43 @@ test("plays no sound when the participant list is more than the maximum size", (
|
|||||||
});
|
});
|
||||||
expect(playSound).toBeCalledWith("left");
|
expect(playSound).toBeCalledWith("left");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("plays one sound when a hand is raised", () => {
|
||||||
|
const { session, vm } = getMockEnv([local, alice]);
|
||||||
|
render(<TestComponent rtcSession={session} vm={vm} />);
|
||||||
|
// Joining a call usually means remote participants are added later.
|
||||||
|
act(() => {
|
||||||
|
vm.updateReactions({
|
||||||
|
raisedHands: {
|
||||||
|
[bobRtcMember.callId]: new Date(),
|
||||||
|
},
|
||||||
|
reactions: {},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
expect(playSound).toBeCalledWith("raiseHand");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("should not play a sound when a hand raise is retracted", () => {
|
||||||
|
const { session, vm } = getMockEnv([local, alice]);
|
||||||
|
render(<TestComponent rtcSession={session} vm={vm} />);
|
||||||
|
// Joining a call usually means remote participants are added later.
|
||||||
|
act(() => {
|
||||||
|
vm.updateReactions({
|
||||||
|
raisedHands: {
|
||||||
|
["foo"]: new Date(),
|
||||||
|
["bar"]: new Date(),
|
||||||
|
},
|
||||||
|
reactions: {},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
expect(playSound).toHaveBeenCalledTimes(2);
|
||||||
|
act(() => {
|
||||||
|
vm.updateReactions({
|
||||||
|
raisedHands: {
|
||||||
|
["foo"]: new Date(),
|
||||||
|
},
|
||||||
|
reactions: {},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
expect(playSound).toHaveBeenCalledTimes(2);
|
||||||
|
});
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ import { oneOnOneLayout } from "./OneOnOneLayout";
|
|||||||
import { pipLayout } from "./PipLayout";
|
import { pipLayout } from "./PipLayout";
|
||||||
import { EncryptionSystem } from "../e2ee/sharedKeyManagement";
|
import { EncryptionSystem } from "../e2ee/sharedKeyManagement";
|
||||||
import { observeSpeaker } from "./observeSpeaker";
|
import { observeSpeaker } from "./observeSpeaker";
|
||||||
import { useReactions } from "../useReactions";
|
|
||||||
import { ReactionOption } from "../reactions";
|
import { ReactionOption } from "../reactions";
|
||||||
|
|
||||||
// How long we wait after a focus switch before showing the real participant
|
// How long we wait after a focus switch before showing the real participant
|
||||||
@@ -1122,10 +1121,13 @@ export class CallViewModel extends ViewModel {
|
|||||||
Record<string, ReactionOption>
|
Record<string, ReactionOption>
|
||||||
>();
|
>();
|
||||||
|
|
||||||
public readonly handRaised = this.handsRaisedSubject.asObservable();
|
public readonly handsRaised = this.handsRaisedSubject.asObservable();
|
||||||
public readonly reactions = this.reactionsSubject.asObservable();
|
public readonly reactions = this.reactionsSubject.asObservable();
|
||||||
|
|
||||||
public updateReactions(data: ReturnType<typeof useReactions>): void {
|
public updateReactions(data: {
|
||||||
|
raisedHands: Record<string, Date>;
|
||||||
|
reactions: Record<string, ReactionOption>;
|
||||||
|
}): void {
|
||||||
this.handsRaisedSubject.next(data.raisedHands);
|
this.handsRaisedSubject.next(data.raisedHands);
|
||||||
this.reactionsSubject.next(data.reactions);
|
this.reactionsSubject.next(data.reactions);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user