Play sound for raised hand.

This commit is contained in:
Nicholas Tinsley
2023-12-22 17:25:53 -05:00
committed by Clark Chen
parent b4f2208bae
commit 1b9cf631be
5 changed files with 32 additions and 0 deletions

View File

@@ -259,6 +259,8 @@ public class GroupConnectedActionProcessor extends GroupActionProcessor {
@Override
protected @NonNull WebRtcServiceState handleGroupCallRaisedHand(@NonNull WebRtcServiceState currentState, List<Long> raisedHands) {
Log.i(TAG, "handleGroupCallRaisedHand():");
boolean playSound = false;
long now = System.currentTimeMillis();
WebRtcServiceStateBuilder.CallInfoStateBuilder builder = currentState.builder().changeCallInfoState();
Long localDemuxId = currentState.getCallInfoState().requireGroupCall().getLocalDeviceState().getDemuxId();
@@ -270,6 +272,7 @@ public class GroupConnectedActionProcessor extends GroupActionProcessor {
boolean wasHandAlreadyRaised = updatedParticipant.isHandRaised();
if (raisedHandIndex >= 0 && !wasHandAlreadyRaised) {
builder.putParticipant(updatedParticipant.getCallParticipantId(), updatedParticipant.withHandRaisedTimestamp(now + raisedHandIndex));
playSound = true;
} else if (raisedHandIndex < 0 && wasHandAlreadyRaised) {
builder.putParticipant(updatedParticipant.getCallParticipantId(), updatedParticipant.withHandRaisedTimestamp(CallParticipant.HAND_LOWERED));
}
@@ -290,6 +293,10 @@ public class GroupConnectedActionProcessor extends GroupActionProcessor {
new CallParticipantId(localDemuxId, Recipient.self().getId())));
}
}
if (playSound) {
webRtcInteractor.playStateChangeUp();
}
return builder.build();
}
}

View File

@@ -165,6 +165,10 @@ public class WebRtcInteractor {
WebRtcCallService.sendAudioManagerCommand(context, new AudioManagerCommand.SetDefaultDevice(recipientId, userDevice, clearUserEarpieceSelection));
}
public void playStateChangeUp() {
WebRtcCallService.sendAudioManagerCommand(context, new AudioManagerCommand.PlayStateChangeUp());
}
void peekGroupCallForRingingCheck(@NonNull GroupCallRingCheckInfo groupCallRingCheckInfo) {
signalCallManager.peekGroupCallForRingingCheck(groupCallRingCheckInfo);
}