OpenReel Video - Professional browser-based video editor. Open source CapCut alternative. 100% browser-based, no installation, no cloud uploads, no watermarks.
TypeScript
import React from "react";
import { useTimelineStore } from "../../../stores/timeline-store";
interface PlayheadProps {
position?: number;
pixelsPerSecond: number;
scrollX: number;
headerOffset: number;
phone?: boolean;
phoneHeight?: number;
}
// Mockup playhead: thin accent vertical line with a downward triangle at the
// top. Color comes from --accent so it tracks the active theme.
export const Playhead: React.FC<PlayheadProps> = ({
position: suppliedPosition,
pixelsPerSecond,
scrollX,
headerOffset,
phone = false,
phoneHeight = 166,
}) => {
const position = useTimelineStore(state => suppliedPosition ?? (phone ? 0 : state.playheadPosition));
const pixelPosition = position * pixelsPerSecond - scrollX;
if (pixelPosition < 0) return null;
if (phone) return <div className="mobile-timeline-playhead" aria-hidden="true" style={{ height: phoneHeight }}><span /></div>;
return (
<div
className="absolute top-0 bottom-0 z-50 pointer-events-none"
style={{
left: headerOffset,
transform: `translateX(${pixelPosition}px)`,
willChange: "transform",
}}
>
{/* pentagon handle at the top */}
<div
className="absolute"
style={{
top: 0,
left: -7,
width: 15,
height: 13,
background: "var(--accent)",
borderRadius: "3px 3px 0 0",
clipPath: "polygon(0 0,100% 0,100% 65%,50% 100%,0 65%)",
}}
/>
{/* vertical line */}
<div
className="absolute"
style={{
top: 0,
bottom: 0,
left: 0,
width: "2px",
background: "var(--accent)",
}}
/>
</div>
);
};