:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(session-replay): remove narration comments from PlayerFrameMetaOverlay (#98845)
posthog[bot]c622a9604f3a
diff --git a/frontend/src/scenes/session-recordings/player/PlayerFrameMetaOverlay.tsx b/frontend/src/scenes/session-recordings/player/PlayerFrameMetaOverlay.tsxindex 4835cb8450e7..fb61ce1fbd39 100644--- a/frontend/src/scenes/session-recordings/player/PlayerFrameMetaOverlay.tsx+++ b/frontend/src/scenes/session-recordings/player/PlayerFrameMetaOverlay.tsx@@ -21,51 +21,39 @@ export function PlayerFrameMetaOverlay(): JSX.Element | null {const { logicProps, currentURL, currentPlayerTimeSeconds, currentSegment, endReached, currentPlayerState } =useValues(sessionRecordingPlayerLogic)- // Load pre-processed segmentsconst { segments: recordingSegments } = useValues(sessionRecordingDataCoordinatorLogic(logicProps))- // Track when recording playback started (for VIDEO_T display)const recordingPlaybackStartTime = useRef<number | null>(null)- // Track how much time passed since the first playback started (state for re-renders)const [timePassedSinceFirstPlayback, setTimePassedSinceFirstPlayback] = useState<number | null>(null)- // Process all segments at once when available to fill data on all active/inactive periodsuseEffect(() => {- // Reset segment tracking globalswindow.__POSTHOG_CURRENT_SEGMENT_START_TS__ = undefinedwindow.__POSTHOG_SEGMENT_COUNTER__ = 0- // If no segments available - no periods to trackif (!recordingSegments || recordingSegments.length === 0) {window.__POSTHOG_INACTIVITY_PERIODS__ = []return}- // Segments use Unix timestamps, so we need to use them also (instead of 0 as a start)+ // Segments carry Unix timestamps, so each period is relative to the first segment instead of to 0const recordingStartTimestamp = recordingSegments[0].startTimestamp- // Convert segments into inactivity periods metadata- // Note: recording_ts_from_s will be added by the backend based on actual video time+ // The backend adds recording_ts_from_s to each period from the actual video timeconst periods: ReplayInactivityPeriod[] = recordingSegments- // Skipping buffers, keeping windows and gaps.filter((segment) => segment.kind !== 'buffer' && segment.kind !== 'gap').map((segment) => ({ts_from_s: (segment.startTimestamp - recordingStartTimestamp) / 1000,ts_to_s: (segment.endTimestamp - recordingStartTimestamp) / 1000,active: segment.isActive ?? true,}))- // Ensure to keep only periods with >0 duration.filter((p) => p.ts_to_s > p.ts_from_s)- // Store into the global variable to be used by the backendwindow.__POSTHOG_INACTIVITY_PERIODS__ = periods}, [recordingSegments])- // Track when the first playback starts (for VIDEO_T display)useEffect(() => {if (currentPlayerState === SessionPlayerState.PLAY && recordingPlaybackStartTime.current === null) {recordingPlaybackStartTime.current = performance.now()}}, [currentPlayerState])- // Update elapsed time display every seconduseEffect(() => {const interval = setInterval(() => {if (recordingPlaybackStartTime.current !== null) {@@ -75,25 +63,20 @@ export function PlayerFrameMetaOverlay(): JSX.Element | null {return () => clearInterval(interval)}, [])- // Signal segment changes to backend via globals- // Backend will track actual video timestamps when these changeuseEffect(() => {if (!currentSegment || !recordingSegments?.length) {return}- // Track only active segments (inactive segments are tracked via __POSTHOG_INACTIVITY_PERIODS__ above)+ // Only active segments use these globals, because __POSTHOG_INACTIVITY_PERIODS__ carries the inactive onesif (!currentSegment.isActive) {return}- // Calculate ts_from_s for this segmentconst recordingStartTimestamp = recordingSegments[0].startTimestampconst segmentTsFromS = (currentSegment.startTimestamp - recordingStartTimestamp) / 1000- // Update globals to signal segment change to backendwindow.__POSTHOG_CURRENT_SEGMENT_START_TS__ = segmentTsFromSwindow.__POSTHOG_SEGMENT_COUNTER__ = (window.__POSTHOG_SEGMENT_COUNTER__ || 0) + 1}, [currentSegment, recordingSegments])- // Skip rendering if no URL or player time is not available yetif (!currentURL || currentPlayerTimeSeconds === undefined) {return null}@@ -107,7 +90,7 @@ export function PlayerFrameMetaOverlay(): JSX.Element | null {<span className="font-bold">REC_T:</span> {currentPlayerTimeSeconds}</span>{timePassedSinceFirstPlayback !== null && (- // TIP: Display for debugging+ // Hidden by default, unhide it to debug video timing<span style={{ display: 'none' }}><span className="font-bold">VIDEO_T:</span> {timePassedSinceFirstPlayback.toFixed(0)}</span>