Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fixes: iOS fullscreen + Safari syncing

Richie McIlroy614d3c5e9fa7
diff --git a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
index 3b00bdbfb..2f6b4e452 100644
--- a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
+++ b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
@@ -13,6 +13,12 @@ import { LogoSpinner } from "@cap/ui";
import { userSelectProps } from "@cap/database/auth/session";
import { Tooltip } from "react-tooltip";
+declare global {
+ interface Window {
+ MSStream: any;
+ }
+}
+
const formatTime = (time: number) => {
const minutes = Math.floor(time / 60);
const seconds = Math.floor(time % 60);
@@ -194,7 +200,10 @@ export const ShareVideo = ({
const handleFullscreenClick = () => {
const player = document.getElementById("player");
- if (!document.fullscreenElement) {
+ const isIOS =
+ /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
+
+ if (!document.fullscreenElement && !isIOS) {
player
?.requestFullscreen()
.catch((err) =>
@@ -202,6 +211,9 @@ export const ShareVideo = ({
`Error attempting to enable full-screen mode: ${err.message} (${err.name})`
)
);
+ } else if (isIOS && videoRef.current) {
+ const videoUrl = videoRef.current.src;
+ window.open(videoUrl, "_blank");
} else {
document.exitFullscreen();
}
@@ -283,14 +295,14 @@ export const ShareVideo = ({
onTouchEnd={handleSeekMouseUp}
>
{!isLoading && comments !== null && (
- <div className="w-full -mt-5">
+ <div className="w-full -mt-7 md:-mt-6">
{comments.map((comment) => {
if (comment.timestamp === null) return null;
return (
<div
key={comment.id}
- className="absolute z-10 text-[16px]"
+ className="absolute z-10 text-[16px] hover:scale-125 transition-all"
style={{
left: `${(comment.timestamp / longestDuration) * 100}%`,
}}
@@ -319,13 +331,13 @@ export const ShareVideo = ({
})}
</div>
)}
- <div className="absolute top-1.5 w-full h-1 bg-white bg-opacity-50 rounded-full z-0" />
+ <div className="absolute top-1.5 w-full h-1.5 bg-white bg-opacity-50 rounded-full z-10" />
<div
- className="absolute top-1.5 h-1 bg-white rounded-full cursor-pointer transition-all duration-300 z-0"
+ className="absolute top-1.5 h-1.5 bg-white rounded-full cursor-pointer transition-all duration-300 z-10"
style={{ width: `${watchedPercentage}%` }}
/>
<div
- className="drag-button absolute top-1.5 z-10 -mt-1.5 -ml-2 w-4 h-4 bg-white rounded-full border border-white cursor-pointer focus:ring-2 focus:ring-indigo-600 focus:ring-opacity-80 focus:outline-none transition-all duration-300"
+ className="drag-button absolute top-1.5 z-20 -mt-1.5 -ml-2 w-4 h-4 bg-white rounded-full border border-white cursor-pointer focus:ring-2 focus:ring-indigo-600 focus:ring-opacity-80 focus:outline-none transition-all duration-300"
tabIndex={0}
style={{ left: `${watchedPercentage}%` }}
/>
diff --git a/apps/web/app/s/[videoId]/_components/VideoPlayer.tsx b/apps/web/app/s/[videoId]/_components/VideoPlayer.tsx
index 27da4a7f5..28ffce7b3 100644
--- a/apps/web/app/s/[videoId]/_components/VideoPlayer.tsx
+++ b/apps/web/app/s/[videoId]/_components/VideoPlayer.tsx
@@ -27,14 +27,10 @@ export const VideoPlayer = memo(
media: HTMLMediaElement,
hlsInstance: React.MutableRefObject<Hls | null>
) => {
- if (Hls.isSupported()) {
- const hls = new Hls();
- hlsInstance.current = hls;
- hls.loadSource(src);
- hls.attachMedia(media);
- } else if (media.canPlayType("application/vnd.apple.mpegurl")) {
- media.src = src;
- }
+ const hls = new Hls();
+ hlsInstance.current = hls;
+ hls.loadSource(src);
+ hls.attachMedia(media);
};
useEffect(() => {
@@ -76,14 +72,27 @@ export const VideoPlayer = memo(
audio.currentTime = video.currentTime;
};
+ const volumeChangeListener = () => {
+ audio.muted = video.muted;
+ };
+
+ const endedListener = () => {
+ audio.pause();
+ audio.currentTime = 0;
+ };
+
video.addEventListener("play", playListener);
video.addEventListener("pause", pauseListener);
video.addEventListener("seeked", seekListener);
+ video.addEventListener("volumechange", volumeChangeListener);
+ video.addEventListener("ended", endedListener);
return () => {
video.removeEventListener("play", playListener);
video.removeEventListener("pause", pauseListener);
video.removeEventListener("seeked", seekListener);
+ video.removeEventListener("volumechange", volumeChangeListener);
+ video.removeEventListener("ended", endedListener);
};
}, [audioSrc]);
diff --git a/apps/web/components/pages/HomePage.tsx b/apps/web/components/pages/HomePage.tsx
index 0c94486be..181fab9c9 100644
--- a/apps/web/components/pages/HomePage.tsx
+++ b/apps/web/components/pages/HomePage.tsx
@@ -47,11 +47,11 @@ export const HomePage = () => {
<div className="wrapper wrapper-sm mx-auto">
<div className="mb-auto -mt-20 text-center md:px-4 pt-32 pb-52 md:pt-52 md:pb-64 space-y-8">
<h1 className="fade-in-down text-3xl sm:text-5xl lg:text-7xl relative z-10 text-black">
- Your screen recordings deserve to be beautiful.
+ Effortless, instant screen sharing.
</h1>
<p className="fade-in-down animate-delay-1 text-base sm:text-xl max-w-2xl mx-auto text-black mb-8">
- Cap is an open source and privacy-focused alternative to Loom.
- Lightweight, powerful, and stunning. Record and share in seconds.
+ Cap is the powerful open source alternative to Loom. Lightweight,
+ powerful, and stunning. Record and share in seconds.
</p>
{waitlistSuccess === true ? (
<div className="fade-in-up max-w-lg mx-auto styled-links">
@@ -137,8 +137,8 @@ export const HomePage = () => {
<span className="text-white">Star on GitHub</span>
</a>
</div>
- <p className="text-gray-600 text-sm">
- Coming soon to macOS, Windows and Linux.
+ <p className="text-gray-500 text-sm">
+ Early access testing is currently underway.
</p>
</div>
)}
diff --git a/packages/ui/style/tailwind.config.js b/packages/ui/style/tailwind.config.js
index 62f80da57..307978e1d 100644
--- a/packages/ui/style/tailwind.config.js
+++ b/packages/ui/style/tailwind.config.js
@@ -84,13 +84,13 @@ module.exports = function (app, options) {
opacity: "0.7",
},
"100%": {
- transform: "translateY(-150px) scale(2)",
+ transform: "translateY(-150px) scale(2.5)",
opacity: "0",
},
},
},
animation: {
- flyEmoji: "flyEmoji 1s forwards",
+ flyEmoji: "flyEmoji 1.5s forwards",
},
},
},