: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
fix(replay): fix three player control papercuts (#63100)
Tue Haulund7ba7806bde79
diff --git a/frontend/src/scenes/session-recordings/player/PlayerSummaryViews.tsx b/frontend/src/scenes/session-recordings/player/PlayerSummaryViews.tsxindex d483b2f76cfd..c8f3c351b20e 100644--- a/frontend/src/scenes/session-recordings/player/PlayerSummaryViews.tsx+++ b/frontend/src/scenes/session-recordings/player/PlayerSummaryViews.tsx@@ -685,6 +685,9 @@ function SessionSummaryOutcomeBanner({ sessionSummary }: { sessionSummary: Sessifunction SessionSummarySegments({ sessionSummary }: { sessionSummary: SessionSummaryContent }): JSX.Element | null {const { seekToTime } = useActions(sessionRecordingPlayerLogic)+ // "Play from this moment" should start playback even if the player is paused+ const seekToTimeAndPlay = (time: number): void => seekToTime(time, true)+if (!sessionSummary?.segments) {return null}@@ -704,7 +707,7 @@ function SessionSummarySegments({ sessionSummary }: { sessionSummary: SessionSumsegment={segment}segmentOutcome={matchingSegmentOutcome}keyActions={matchingKeyActions || []}- onSeekToTime={seekToTime}+ onSeekToTime={seekToTimeAndPlay}/>)})}diff --git a/frontend/src/scenes/session-recordings/player/controller/seekbarLogic.ts b/frontend/src/scenes/session-recordings/player/controller/seekbarLogic.tsindex b0ceedb68500..5d91ac10797e 100644--- a/frontend/src/scenes/session-recordings/player/controller/seekbarLogic.ts+++ b/frontend/src/scenes/session-recordings/player/controller/seekbarLogic.ts@@ -7,7 +7,7 @@ import {sessionRecordingPlayerLogic,} from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'-import { InteractEvent, ReactInteractEvent, THUMB_OFFSET, THUMB_SIZE, getXPos } from '../utils/playerUtils'+import { InteractEvent, ReactInteractEvent, THUMB_OFFSET, getXPos } from '../utils/playerUtils'import type { seekbarLogicType } from './seekbarLogicType'export const seekbarLogic = kea<seekbarLogicType>([@@ -168,7 +168,9 @@ export const seekbarLogic = kea<seekbarLogicType>([actions.startScrub()const xPos = getXPos(event)let diffFromThumb = xPos - values.thumb.getBoundingClientRect().left - THUMB_OFFSET- if (Math.abs(diffFromThumb) > THUMB_SIZE) {+ // Only a press on the thumb itself keeps the grab offset; pressing the bar next to+ // it seeks to the exact position — otherwise small seeks near the thumb go nowhere+ if (Math.abs(diffFromThumb) > THUMB_OFFSET) {diffFromThumb = 0}actions.setCursorDiff(diffFromThumb)diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.tsindex bfdd0baf62ce..9ec7b098e297 100644--- a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts+++ b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts@@ -541,7 +541,7 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(setScale: (scale: number) => ({ scale }),togglePlayPause: true,seekToTimestamp: (timestamp: number, forcePlay: boolean = false) => ({ timestamp, forcePlay }),- seekToTime: (timeInMilliseconds: number) => ({ timeInMilliseconds }),+ seekToTime: (timeInMilliseconds: number, forcePlay: boolean = false) => ({ timeInMilliseconds, forcePlay }),seekForward: (amount?: number) => ({ amount }),seekBackward: (amount?: number) => ({ amount }),seekToStart: true,@@ -1755,9 +1755,11 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(const currentTime = values.currentPlayerTime || 0let targetTime = currentTime - amount- // If in a gap > 3s or would land in a gap > 3s: go to end of previous activity - amount+ // When skipping inactivity, rewinding into a gap > 3s would just bounce forward+ // to the gap's end again, so land before the gap instead — applying only the+ // not-yet-rewound part of the jump so the total rewind stays predictable.// Otherwise: normal rewind- if (values.sessionPlayerData.start && values.currentTimestamp) {+ if (values.skipInactivitySetting && values.sessionPlayerData.start && values.currentTimestamp) {const startTimestamp = values.sessionPlayerData.start.valueOf()const segments = values.sessionPlayerData.segmentsconst currentSegment = values.segmentForTimestamp(values.currentTimestamp)@@ -1775,22 +1777,23 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(const findSegmentIndex = (segment: RecordingSegment): number =>segments.findIndex((s) => s.startTimestamp === segment.startTimestamp && s.kind === segment.kind)- const seekToPrevActivityEnd = (segment: RecordingSegment): void => {+ const seekToPrevActivityEnd = (segment: RecordingSegment, rewindMs: number): void => {const prevActivity = findPrevActivitySegment(findSegmentIndex(segment))if (prevActivity) {const prevStart = prevActivity.startTimestamp - startTimestampconst prevEnd = prevActivity.endTimestamp - startTimestamp- targetTime = Math.max(prevStart, prevEnd - amount)+ targetTime = Math.max(prevStart, prevEnd - rewindMs)}}if (currentSegment?.kind === 'gap' && currentSegment.durationMs > minGapDuration) {- seekToPrevActivityEnd(currentSegment)+ seekToPrevActivityEnd(currentSegment, amount)} else {const targetTimestamp = startTimestamp + targetTimeconst targetSegment = values.segmentForTimestamp(targetTimestamp)if (targetSegment?.kind === 'gap' && targetSegment.durationMs > minGapDuration) {- seekToPrevActivityEnd(targetSegment)+ const rewoundBeforeGap = currentTime - (targetSegment.endTimestamp - startTimestamp)+ seekToPrevActivityEnd(targetSegment, Math.max(amount - rewoundBeforeGap, 0))}}}@@ -1810,7 +1813,7 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(}, 'seekIndicatorTimer')},- seekToTime: ({ timeInMilliseconds }) => {+ seekToTime: ({ timeInMilliseconds, forcePlay }) => {if (values.currentTimestamp === undefined) {return}@@ -1825,7 +1828,14 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(values.sessionPlayerData.end.valueOf())- actions.seekToTimestamp(newTimestamp)+ if (forcePlay && values.playingState === SessionPlayerState.PAUSE) {+ // setPlay seeks to currentTimestamp, so set the target first — seeking and then+ // playing would rebuild the replayer twice, which can take seconds on large recordings+ actions.setCurrentTimestamp(newTimestamp)+ actions.setPlay()+ } else {+ actions.seekToTimestamp(newTimestamp, forcePlay)+ }},seekToStart: () => {actions.seekToTime(0)