Jitsi Meet Lib remote video track not getting attached after unmute

I am Intigrating Jitsi with Jitsi meet lib in React, I am showing local as well as remote video track by attaching it to <video>. Also listening to mute status change and attaching and detaching depending on the mute status, but for remote video the video is attached properly first, then it is detach if track is mute but when track is again unmute video track is not attached to the

Code

  room.on(JitsiMeetJS.events.conference.TRACK_MUTE_CHANGED, (track) => {
            console.log(`Muted ${track.getType()} track from ${track.getParticipantId()}`);
            if (track.isVideoTrack()) {
                if (track.isMuted()) {
                    track.detach(document.getElementById(`v${track.getParticipantId()}`))
                } else {
                    console.log(track.getParticipantId())
                    track.attach(document.getElementById(`v${track.getParticipantId()}`))
                }
            }
        })

Elements with that ids exists in the ReactDOM and their is not problem for local track