feat: add join sound tip to voice

This commit is contained in:
Tristan Yang
2023-04-03 11:29:11 +08:00
parent 6472e52d4d
commit 1c658354f2
3 changed files with 8 additions and 1 deletions
Binary file not shown.
+4 -1
View File
@@ -5,7 +5,7 @@ import { useGetAgoraConfigQuery, useGetAgoraVoicingListQuery, useLazyGetAgoraTok
import { updateChannelVisibleAside } from '../../app/slices/channels';
import { addVoiceMember, removeVoiceMember, updateDeafenStatus, updateMuteStatus, updateVoicingInfo, updateVoicingMember, updateVoicingNetworkQuality, upsertVoiceList } from '../../app/slices/voice';
import { useAppSelector } from '../../app/store';
import AudioJoin from '../../assets/join.wav';
// type Props = {}
window.VOICE_TRACK_MAP = window.VOICE_TRACK_MAP ?? {};
// let tmpUids: number[] = [];
@@ -129,6 +129,7 @@ type VoiceProps = {
id: number,
context?: "channel" | "dm"
}
const audioJoin = new Audio(AudioJoin);
const useVoice = ({ id, context = "channel" }: VoiceProps) => {
const dispatch = useDispatch();
const { voicingInfo } = useAppSelector(store => {
@@ -156,6 +157,8 @@ const useVoice = ({ id, context = "channel" }: VoiceProps) => {
localTrack = await AgoraRTC.createMicrophoneAudioTrack();
// Publish the local audio track in the channel.
await window.VOICE_CLIENT.publish(localTrack);
// play the join audio
audioJoin.play();
console.log("Publish success!,joined the channel");
dispatch(updateVoicingInfo({
deafen: false,
+4
View File
@@ -9,6 +9,10 @@ declare namespace NodeJS {
}
}
declare module "*.wav" {
const src: string;
export default src;
}
declare module "*.avif" {
const src: string;
export default src;