Fix a rendering crash when relay put bad data in 39004.
This commit is contained in:
+6
-6
@@ -123,7 +123,7 @@ export const deriveVoiceParticipants = (url: string, h: string) =>
|
|||||||
if (!latestEvent) return []
|
if (!latestEvent) return []
|
||||||
const participants = removeUndefined(
|
const participants = removeUndefined(
|
||||||
map(
|
map(
|
||||||
(tag: string[]) => (tag[1] ? participantFromLiveKitIdentity(tag[1]) : undefined),
|
(tag: string[]) => (tag[1] ? {pubkey: tag[1], identity: tag[1]} : undefined),
|
||||||
getTags("participant", latestEvent.tags),
|
getTags("participant", latestEvent.tags),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -133,8 +133,6 @@ export const deriveVoiceParticipants = (url: string, h: string) =>
|
|||||||
)
|
)
|
||||||
|
|
||||||
const onRoomDisconnected = (reason?: DisconnectReason) => {
|
const onRoomDisconnected = (reason?: DisconnectReason) => {
|
||||||
speakingParticipants.set([])
|
|
||||||
participantPubkeyMap.set(new Map())
|
|
||||||
currentVoiceSession.set(undefined)
|
currentVoiceSession.set(undefined)
|
||||||
if (reason !== undefined && reason !== DisconnectReason.CLIENT_INITIATED) {
|
if (reason !== undefined && reason !== DisconnectReason.CLIENT_INITIATED) {
|
||||||
voiceState.set("disconnected")
|
voiceState.set("disconnected")
|
||||||
@@ -144,6 +142,8 @@ const onRoomDisconnected = (reason?: DisconnectReason) => {
|
|||||||
: "Voice connection lost."
|
: "Voice connection lost."
|
||||||
pushToast({theme: "error", message})
|
pushToast({theme: "error", message})
|
||||||
}
|
}
|
||||||
|
speakingParticipants.set([])
|
||||||
|
participantPubkeyMap.set(new Map())
|
||||||
}
|
}
|
||||||
|
|
||||||
const onTrackSubscribed = (track: Track) => {
|
const onTrackSubscribed = (track: Track) => {
|
||||||
@@ -257,11 +257,11 @@ export const leaveVoiceRoom = async () => {
|
|||||||
const audio = new Audio("/leave-voice-room.mp3")
|
const audio = new Audio("/leave-voice-room.mp3")
|
||||||
audio.play().catch(() => {})
|
audio.play().catch(() => {})
|
||||||
|
|
||||||
|
voiceState.set("disconnected")
|
||||||
|
currentVoiceSession.set(undefined)
|
||||||
|
session.room.disconnect()
|
||||||
speakingParticipants.set([])
|
speakingParticipants.set([])
|
||||||
participantPubkeyMap.set(new Map())
|
participantPubkeyMap.set(new Map())
|
||||||
voiceState.set("disconnected")
|
|
||||||
session.room.disconnect()
|
|
||||||
currentVoiceSession.set(undefined)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const rejoinVoiceRoom = () => {
|
export const rejoinVoiceRoom = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user