文档

支持

Vivox Unreal SDK

Vivox Unreal SDK

Mute other users

Learn how to let players mute other users.
阅读时间1 分钟最后更新于 18 小时前

Vivox Unreal provides the following functions to mute another user:
  • IParticipantProperties::BeginSetLocalMute(bool setMuted, FOnBeginSetLocalMuteCompletedDelegate theDelegate = FOnBeginSetLocalMuteCompletedDelegate())
  • IParticipantProperties::BeginSetIsMutedForAll(bool setMuted, const FString& accessToken, FOnBeginSetIsMutedForAllCompletedDelegate theDelegate = FOnBeginSetIsMutedForAllCompletedDelegate())
Use
BeginSetLocalMute
to mute or unmute a participant for the currently connected user.
void MuteParticipantForMe(IParticipant &participantToMute){ IParticipant::FOnBeginSetLocalMuteCompletedDelegate BeginSetLocalMuteCompletedCallback; bool IsMuted = false; BeginSetLocalMuteCompletedCallback.BindLambda([this, &IsMuted](VivoxCoreError Status) { if(VxErrorSuccess == Status) { IsMuted = true; // This bool is only illustrative. The participant is now muted. } }); participantToMute.BeginSetLocalMute(true, BeginSetLocalMuteCompletedCallback);}
Use
BeginSetIsMutedForAll
to send a request to the Vivox server to mute the participant for all participants in the channel. This requires an access token that you can produce with
IParticipantProperties::GetMuteForAllToken()
.For more information, refer to the Access Token Developer Guide.
void MuteParticipantForAll(IParticipant &participantToMute){ IParticipant::FOnBeginSetIsMutedForAllCompletedDelegate BeginSetIsMutedForAllCompletedCallback; bool IsMutedForAll = false; BeginSetIsMutedForAllCompletedCallback.BindLambda([this, &IsMutedForAll](VivoxCoreError Status) { if(VxErrorSuccess == Status) { IsMutedForAll = true; // This bool is only illustrative. The participant is now muted. } }); participantToMute.BeginSetIsMutedForAll(true, participantToMute.GetMuteForAllToken(kDefaultKey, kDefaultExpiration), BeginSetIsMutedForAllCompletedCallback);}