Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(share): add background preview mode to HLS video player
Richie McIlroy8488230b7ccc
diff --git a/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsx b/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsxindex 711364b4e..2b1ddb7f0 100644--- a/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsx+++ b/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsx@@ -100,6 +100,7 @@ interface Props {hasCaptions?: boolean;canRetryProcessing?: boolean;duration?: number | null;+ previewMode?: "background";}export function HLSVideoPlayer({@@ -123,6 +124,7 @@ export function HLSVideoPlayer({hasCaptions = false,canRetryProcessing = false,duration: fallbackDuration,+ previewMode,}: Props) {const hlsInstance = useRef<Hls | null>(null);const [currentCue, setCurrentCue] = useState<string>("");@@ -144,6 +146,7 @@ export function HLSVideoPlayer({const router = useRouter();const segmentRetryCountRef = useRef(0);const hasTriedRouterRefreshRef = useRef(false);+ const isBackgroundPreview = previewMode === "background";const playbackSrc =sourceVersion === 0? videoSrc@@ -530,7 +533,9 @@ export function HLSVideoPlayer({(uploadProgressRaw?.status === "error" ||uploadProgressRaw?.status === "failed");const uploadProgress =- videoLoaded || isErrorWhileHlsLoading ? null : uploadProgressRaw;+ isBackgroundPreview || videoLoaded || isErrorWhileHlsLoading+ ? null+ : uploadProgressRaw;const isUploading = uploadProgress?.status === "uploading";const isProcessing = uploadProgress?.status === "processing";const isGeneratingThumbnail =@@ -599,6 +604,7 @@ export function HLSVideoPlayer({className={clsx(mediaPlayerClassName,"[&::-webkit-media-text-track-display]:!hidden",+ isBackgroundPreview && "pointer-events-none [&_video]:opacity-70",)}autoHide>@@ -693,7 +699,8 @@ export function HLSVideoPlayer({{showPlayButton &&videoLoaded &&!hasPlayedOnce &&- !hasActiveProgress && (+ !hasActiveProgress &&+ !isBackgroundPreview && (<motion.divwhileHover={{ scale: 1.1 }}whileTap={{ scale: 0.9 }}@@ -718,7 +725,8 @@ export function HLSVideoPlayer({!hasPlayedOnce &&!hasFailedOrError &&!hlsInitFailed &&- !isLiveSegments+ !isLiveSegments &&+ !isBackgroundPreview}/><MediaPlayerVideo@@ -731,6 +739,9 @@ export function HLSVideoPlayer({}}playsInlineautoPlay={autoplay}+ muted={isBackgroundPreview}+ loop={isBackgroundPreview}+ preload="auto">{chaptersSrc && <track default kind="chapters" src={chaptersSrc} />}{captionsSrc && (@@ -761,7 +772,9 @@ export function HLSVideoPlayer({<MediaPlayerVolumeIndicator /><MediaPlayerControlsclassName="flex-col items-start gap-2.5"- isUploadingOrFailed={hasActiveProgress || hasFailedOrError}+ isUploadingOrFailed={+ isBackgroundPreview || hasActiveProgress || hasFailedOrError+ }><MediaPlayerControlsOverlay /><MediaPlayerSeek fallbackDuration={playerDuration} />