Skip to content

Commit

Permalink
fix(webapp): whep local connected status
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wing committed Jan 10, 2024
1 parent d25a9bc commit ddd4ffa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion webapp/components/player/whep-player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export default function WhepPlayer(props: { streamId: string, status: UserStatus
const [presentationStream, setPresentationStream] = useAtom(presentationStreamAtom)
const refUserStatus = useRef(props.status)
refUserStatus.current = props.status
const refConnState = useRef(connectionState)
refConnState.current = connectionState

const newPeerConnection = () => {
const pc = new RTCPeerConnection()
Expand All @@ -38,7 +40,7 @@ export default function WhepPlayer(props: { streamId: string, status: UserStatus
refPC.current = pc
}

const run = () => refUserStatus.current.state !== "connected" ? restart(props.streamId) : null
const run = () => refUserStatus.current.state !== "connected" || refConnState.current !== "connected" ? restart(props.streamId) : null

const start = async (resource: string) => {
setLoading(false)
Expand Down

0 comments on commit ddd4ffa

Please sign in to comment.