feat(audio) [closes #180] Mute own screen stream (#200)

* refactor: remove redundant function calls

* feat(video): [closes #180] mute self screen stream audio
This commit is contained in:
Jeremy Kahn 2023-11-04 00:54:59 -05:00 committed by GitHub
parent c0b76ff3e1
commit 3a97ee2cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import { VideoStreamType } from 'models/chat'
import { SelectedPeerStream } from './RoomVideoDisplay' import { SelectedPeerStream } from './RoomVideoDisplay'
interface PeerVideoProps { interface PeerVideoProps {
isSelfScreenStream?: boolean
isSelfVideo?: boolean isSelfVideo?: boolean
numberOfVideos: number numberOfVideos: number
onVideoClick?: ( onVideoClick?: (
@ -29,6 +30,7 @@ const nextPerfectSquare = (base: number) => {
} }
export const PeerVideo = ({ export const PeerVideo = ({
isSelfScreenStream,
isSelfVideo, isSelfVideo,
numberOfVideos, numberOfVideos,
onVideoClick, onVideoClick,
@ -87,6 +89,7 @@ export const PeerVideo = ({
> >
<video <video
playsInline playsInline
muted={isSelfScreenStream}
ref={videoRef} ref={videoRef}
onClick={handleVideoClick} onClick={handleVideoClick}
style={{ style={{

View File

@ -173,6 +173,7 @@ export const RoomVideoDisplay = ({
)} )}
{selfScreenStream && ( {selfScreenStream && (
<PeerVideo <PeerVideo
isSelfScreenStream
numberOfVideos={numberOfVideos} numberOfVideos={numberOfVideos}
onVideoClick={handleVideoClick} onVideoClick={handleVideoClick}
userId={userId} userId={userId}

View File

@ -66,8 +66,6 @@ export function useRoomVideo({ peerRoom }: UseRoomVideoConfig) {
type: VideoStreamType.WEBCAM, type: VideoStreamType.WEBCAM,
}) })
setSelfVideoStream(newSelfStream) setSelfVideoStream(newSelfStream)
setSelfVideoStream(newSelfStream)
} }
})() })()
}, [peerRoom, selfVideoStream, setSelfVideoStream]) }, [peerRoom, selfVideoStream, setSelfVideoStream])
@ -144,7 +142,6 @@ export function useRoomVideo({ peerRoom }: UseRoomVideoConfig) {
sendVideoChange(VideoState.STOPPED) sendVideoChange(VideoState.STOPPED)
setVideoState(VideoState.STOPPED) setVideoState(VideoState.STOPPED)
setSelfVideoStream(null) setSelfVideoStream(null)
setSelfVideoStream(null)
} }
} }
})() })()