From 3c431c22e81dbbb00d4bae5090f8e5da2f6fd172 Mon Sep 17 00:00:00 2001 From: Gagan Suie Date: Thu, 20 Jul 2023 12:01:52 -0500 Subject: [PATCH] Fix: removed id from videoItem --- .../Channel/Stream/VideoItem.svelte | 42 +++++++------------ 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/src/lib/components/Channel/Stream/VideoItem.svelte b/src/lib/components/Channel/Stream/VideoItem.svelte index fae74763..ad5599a8 100644 --- a/src/lib/components/Channel/Stream/VideoItem.svelte +++ b/src/lib/components/Channel/Stream/VideoItem.svelte @@ -58,7 +58,7 @@ video._id !== $page.data.user?.userId && role !== '🤖 AI' - $: if (isMounted && (video.screen !== prevScreen)) { + $: if (isMounted && video.screen !== prevScreen) { handleScreenChanges() } @@ -96,20 +96,16 @@ } const toggleClient = ({ trackType }: { trackType: string }) => { - if ($page.data.user?.userId === video._id) { - switch (trackType) { case 'screen': if (video.screen && $is_sharing_screen) { - const key = video.screen.webRTCPlayback.url+"-"+video._id + const key = video.screen.webRTCPlayback.url + '-' + video._id const existed = getScreen(key) - screenWhip = existed || new WHIPClient( - video.screen.webRTC.url, - screenElement, - video.screen.trackType - ) - if(existed){ + screenWhip = + existed || + new WHIPClient(video.screen.webRTC.url, screenElement, video.screen.trackType) + if (existed) { existed.videoElement = screenElement screenElement.srcObject = existed.localStream $is_sharing_screen = true @@ -122,9 +118,8 @@ removeScreen(key) }) screenWhip.addEventListener(`isScreenLive`, (ev: any) => (isScreenLive = ev.detail)) - } - else if(!video.screen){ - if(screenElement){ + } else if (!video.screen) { + if (screenElement) { screenElement.srcObject = null } $is_sharing_screen = false @@ -143,9 +138,8 @@ isWebcamLive = false }) webcamWhip.addEventListener(`isWebcamLive`, (ev: any) => (isWebcamLive = ev.detail)) - } - else if(!video.webcam){ - if(webcamElement){ + } else if (!video.webcam) { + if (webcamElement) { webcamElement.srcObject = null } } @@ -167,19 +161,17 @@ switch (trackType) { case 'screen': if (video.screen && screenElement) { - const key = video.screen.webRTCPlayback.url +"-"+video._id + const key = video.screen.webRTCPlayback.url + '-' + video._id const existed = getScreen(key) - screenWhep = existed || new WHEPClient( - video.screen.webRTCPlayback.url, - screenElement, - video.screen.trackType - ) - if(existed){ + screenWhep = + existed || + new WHEPClient(video.screen.webRTCPlayback.url, screenElement, video.screen.trackType) + if (existed) { existed.videoElement = screenElement screenElement.srcObject = existed.stream isScreenLive = true } - + addScreen(key, screenWhep) screenElement.muted = false screenElement.play() @@ -343,7 +335,6 @@ }, 1000) } } -
(isHoverVideo = true)} on:mouseleave={() => (isHoverVideo = false)}>
- {video._id}