Skip to content

: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.

feat(replay): quill twins for the mode bar controls (#128741)

Hayne Ryub2e8afd00c1b
diff --git a/frontend/src/scenes/session-recordings/player/watch/PlayerModeBar.tsx b/frontend/src/scenes/session-recordings/player/watch/PlayerModeBar.tsx
index 13827581fb6d..1befb7fa05ac 100644
--- a/frontend/src/scenes/session-recordings/player/watch/PlayerModeBar.tsx
+++ b/frontend/src/scenes/session-recordings/player/watch/PlayerModeBar.tsx
@@ -22,21 +22,11 @@ import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'
import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { IconWindow } from 'scenes/session-recordings/player/icons'
-import { DebugReplayButton } from 'scenes/session-recordings/player/player-meta/DebugReplayButton'
import { parseUrl } from 'scenes/session-recordings/player/player-meta/PlayerMeta'
-import {
- InsertInNotebookPlaylistButton,
- MenuActions,
-} from 'scenes/session-recordings/player/player-meta/PlayerMetaLinks'
import { playerMetaLogic } from 'scenes/session-recordings/player/player-meta/playerMetaLogic'
-import {
- InspectDOM,
- SetPlaybackSpeed,
- usePlayerChromeMenuItems,
-} from 'scenes/session-recordings/player/player-meta/PlayerMetaTopSettings'
+import { usePlayerChromeMenuItems } from 'scenes/session-recordings/player/player-meta/PlayerMetaTopSettings'
import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'
import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
-import { PlayerShareMenu } from 'scenes/session-recordings/player/share/PlayerShareMenu'
import { playerSidebarLogic } from 'scenes/session-recordings/player/sidebar/playerSidebarLogic'
import { useLinkedIssuesAvailable } from 'scenes/session-recordings/player/sidebar/useLinkedIssuesAvailable'
import { userLogic } from 'scenes/userLogic'
@@ -44,6 +34,12 @@ import { userLogic } from 'scenes/userLogic'
import { SessionRecordingSidebarTab } from '~/types'
import { debugTabKeys } from './DebugTabBar'
+import { QuillDebugReplayButton } from './QuillDebugReplayButton'
+import { QuillInsertInNotebookPlaylistButton } from './QuillInsertInNotebookPlaylistButton'
+import { QuillInspectDOM } from './QuillInspectDOM'
+import { QuillPlayerActionsMenu } from './QuillPlayerActionsMenu'
+import { QuillPlayerShareMenu } from './QuillPlayerShareMenu'
+import { QuillSetPlaybackSpeed } from './QuillSetPlaybackSpeed'
type PlayerMode = 'watch' | 'debug'
@@ -166,12 +162,12 @@ export function PlayerModeBar(): JSX.Element {
)}
<div className="flex-1 min-w-4" />
<div className="flex items-center gap-0.5">
- {sessionRecordingId && <MenuActions size={size} extraItems={chromeItems} />}
- <SetPlaybackSpeed />
- {debugMode && <InspectDOM />}
- {debugMode && showDebugReplayButton && <DebugReplayButton settingsBar />}
- <InsertInNotebookPlaylistButton size={size} />
- <PlayerShareMenu />
+ {sessionRecordingId && <QuillPlayerActionsMenu extraItems={chromeItems} />}
+ <QuillSetPlaybackSpeed />
+ {debugMode && <QuillInspectDOM />}
+ {debugMode && showDebugReplayButton && <QuillDebugReplayButton />}
+ <QuillInsertInNotebookPlaylistButton size={size} />
+ <QuillPlayerShareMenu />
</div>
</div>
</div>
diff --git a/frontend/src/scenes/session-recordings/player/watch/QuillDebugReplayButton.tsx b/frontend/src/scenes/session-recordings/player/watch/QuillDebugReplayButton.tsx
new file mode 100644
index 000000000000..791c76c26440
--- /dev/null
+++ b/frontend/src/scenes/session-recordings/player/watch/QuillDebugReplayButton.tsx
@@ -0,0 +1,127 @@
+import { useActions, useValues } from 'kea'
+import { useEffect, useMemo, useState } from 'react'
+
+import { IconChevronDown, IconSparkles } from '@posthog/icons'
+import {
+ Button,
+ ButtonGroup,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import {
+ DebugChatSummary,
+ debugReplayChatLogic,
+} from 'scenes/session-recordings/player/player-meta/debugReplayChatLogic'
+import { buildDebugReplayContextItems } from 'scenes/session-recordings/player/player-meta/debugReplayPrompt'
+import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
+
+import { isTerminalRunStatus, useAttachedContext } from 'products/posthog_ai/frontend/api/logics'
+
+import { QuillDebugReplayPromptModal } from './QuillDebugReplayPromptModal'
+
+const PREPARING = 'Loading the recording data for PostHog AI'
+
+function debugChatTooltip(debugChatSummary: DebugChatSummary | undefined): JSX.Element | string {
+ if (debugChatSummary?.summary) {
+ return (
+ <div className="space-y-1">
+ <div className="max-h-80 overflow-y-auto whitespace-pre-line">{debugChatSummary.summary}</div>
+ <div className="text-xs text-muted-foreground">Click to open the chat.</div>
+ </div>
+ )
+ }
+ if (debugChatSummary && !isTerminalRunStatus(debugChatSummary.runStatus)) {
+ return 'PostHog AI is still debugging this recording. Click to open the chat.'
+ }
+ return 'Opens the PostHog AI chat that debugged this recording.'
+}
+
+export function QuillDebugReplayButton(): JSX.Element {
+ const { sessionRecordingId, debugRecordingPreparing } = useValues(sessionRecordingPlayerLogic)
+ const { taskIdBySessionRecordingId, openingSessionRecordingId, debugChatSummaryBySessionRecordingId } =
+ useValues(debugReplayChatLogic)
+ const { openDebugChat, loadDebugChatSummary } = useActions(debugReplayChatLogic)
+ const [promptModalOpen, setPromptModalOpen] = useState(false)
+
+ const contextItems = useMemo(() => buildDebugReplayContextItems(sessionRecordingId), [sessionRecordingId])
+ useAttachedContext(contextItems)
+
+ const hasDebugChat = !!taskIdBySessionRecordingId[sessionRecordingId]
+ const openingDebugChat = openingSessionRecordingId === sessionRecordingId
+ const debugChatSummary = debugChatSummaryBySessionRecordingId[sessionRecordingId]
+
+ useEffect(() => {
+ if (hasDebugChat && !debugChatSummary) {
+ loadDebugChatSummary(sessionRecordingId)
+ }
+ }, [hasDebugChat, debugChatSummary, sessionRecordingId, loadDebugChatSummary])
+
+ const promptModal = promptModalOpen ? (
+ <QuillDebugReplayPromptModal onClose={() => setPromptModalOpen(false)} />
+ ) : null
+
+ if (!hasDebugChat) {
+ return (
+ <>
+ <Button
+ size="xs"
+ onClick={() => setPromptModalOpen(true)}
+ loading={debugRecordingPreparing}
+ tooltip={
+ debugRecordingPreparing
+ ? PREPARING
+ : 'Asks PostHog AI what went wrong in this recording. You can edit the prompt first.'
+ }
+ data-attr="replay-debug-with-ai"
+ >
+ <IconSparkles />
+ Debug this replay
+ </Button>
+ {promptModal}
+ </>
+ )
+ }
+
+ return (
+ <>
+ <ButtonGroup>
+ <Button
+ size="xs"
+ onClick={() => openDebugChat(sessionRecordingId)}
+ loading={openingDebugChat || debugRecordingPreparing}
+ tooltip={debugRecordingPreparing ? PREPARING : debugChatTooltip(debugChatSummary)}
+ data-attr="replay-debug-chat-open"
+ >
+ <IconSparkles />
+ Open debug chat
+ </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ size="icon-xs"
+ aria-label="More debug options"
+ disabledReason={debugRecordingPreparing ? PREPARING : undefined}
+ data-attr="replay-debug-chat-more"
+ />
+ }
+ >
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem
+ onClick={() => setPromptModalOpen(true)}
+ data-attr="replay-debug-with-ai-again"
+ >
+ Debug again in a new chat
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </ButtonGroup>
+ {promptModal}
+ </>
+ )
+}
diff --git a/frontend/src/scenes/session-recordings/player/watch/QuillDebugReplayPromptModal.tsx b/frontend/src/scenes/session-recordings/player/watch/QuillDebugReplayPromptModal.tsx
new file mode 100644
index 000000000000..440627fec85b
--- /dev/null
+++ b/frontend/src/scenes/session-recordings/player/watch/QuillDebugReplayPromptModal.tsx
@@ -0,0 +1,78 @@
+import { useActions, useValues } from 'kea'
+import { ChangeEvent, KeyboardEvent, useState } from 'react'
+
+import {
+ Button,
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Textarea,
+} from '@posthog/quill'
+
+import { buildDebugReplayPrompt } from 'scenes/session-recordings/player/player-meta/debugReplayPrompt'
+import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
+
+export function QuillDebugReplayPromptModal({ onClose }: { onClose: () => void }): JSX.Element {
+ const { sessionRecordingId, currentPlayerTimeSeconds, debugRecordingPreparing } =
+ useValues(sessionRecordingPlayerLogic)
+ const { debugRecordingWithAI } = useActions(sessionRecordingPlayerLogic)
+
+ // The default prompt names the current player time, so it is built once when the dialog opens.
+ const [defaultPrompt] = useState(() => buildDebugReplayPrompt(sessionRecordingId, currentPlayerTimeSeconds))
+ const [prompt, setPrompt] = useState(defaultPrompt)
+ const trimmedPrompt = prompt.trim()
+
+ const submit = (): void => {
+ if (!trimmedPrompt) {
+ return
+ }
+ debugRecordingWithAI(trimmedPrompt, trimmedPrompt !== defaultPrompt)
+ onClose()
+ }
+
+ return (
+ <Dialog open onOpenChange={(open: boolean) => !open && onClose()}>
+ <DialogContent className="max-w-[40rem]">
+ <DialogHeader>
+ <DialogTitle>Debug this replay with PostHog AI</DialogTitle>
+ <DialogDescription>
+ Edit the prompt if you want to. PostHog AI gets the recording data along with it.
+ </DialogDescription>
+ </DialogHeader>
+ <DialogBody>
+ <Textarea
+ value={prompt}
+ rows={10}
+ autoFocus
+ onChange={(event: ChangeEvent<HTMLTextAreaElement>) => setPrompt(event.target.value)}
+ onKeyDown={(event: KeyboardEvent<HTMLTextAreaElement>) => {
+ if (event.key === 'Enter' && (event.metaKey || event.ctrlKey)) {
+ event.preventDefault()
+ submit()
+ }
+ }}
+ data-attr="replay-debug-prompt-input"
+ />
+ </DialogBody>
+ <DialogFooter>
+ <Button variant="outline" onClick={onClose} data-attr="replay-debug-prompt-cancel">
+ Cancel
+ </Button>
+ <Button
+ variant="primary"
+ onClick={submit}
+ loading={debugRecordingPreparing}
+ disabledReason={trimmedPrompt ? undefined : 'Write a prompt first'}
+ data-attr="replay-debug-prompt-submit"
+ >
+ Send to PostHog AI
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ )
+}
diff --git a/frontend/src/scenes/session-recordings/player/watch/QuillInsertInNotebookPlaylistButton.tsx b/frontend/src/scenes/session-recordings/player/watch/QuillInsertInNotebookPlaylistButton.tsx
new file mode 100644
index 000000000000..8159320f9026
--- /dev/null
+++ b/frontend/src/scenes/session-recordings/player/watch/QuillInsertInNotebookPlaylistButton.tsx
@@ -0,0 +1,31 @@
+import { useValues } from 'kea'
+
+import { IconNotebook } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { useNotebookNode } from 'scenes/notebooks/Nodes/NotebookNodeContext'
+import { NotebookNodeType } from 'scenes/notebooks/types'
+import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
+
+export function QuillInsertInNotebookPlaylistButton({ size }: { size: 'small' | 'normal' }): JSX.Element | null {
+ const { sessionRecordingId } = useValues(sessionRecordingPlayerLogic)
+ const nodeLogic = useNotebookNode()
+
+ if (size !== 'normal' || nodeLogic?.props.nodeType !== NotebookNodeType.RecordingPlaylist) {
+ return null
+ }
+
+ return (
+ <Button
+ size="icon-xs"
+ tooltip="Comment in a notebook"
+ aria-label="Comment in a notebook"
+ onClick={() =>
+ nodeLogic.actions.insertAfter({ type: NotebookNodeType.Recording, attrs: { id: sessionRecordingId } })
+ }
+ data-attr="player-meta-add-replay-to-notebook"
+ >
+ <IconNotebook />
+ </Button>
+ )
+}
diff --git a/frontend/src/scenes/session-recordings/player/watch/QuillInspectDOM.tsx b/frontend/src/scenes/session-recordings/player/watch/QuillInspectDOM.tsx
new file mode 100644
index 000000000000..874c585e3674
--- /dev/null
+++ b/frontend/src/scenes/session-recordings/player/watch/QuillInspectDOM.tsx
@@ -0,0 +1,26 @@
+import { useActions, useValues } from 'kea'
+
+import { IconSearch } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
+
+export function QuillInspectDOM(): JSX.Element {
+ const { sessionPlayerMetaData } = useValues(sessionRecordingPlayerLogic)
+ const { openExplorer } = useActions(sessionRecordingPlayerLogic)
+
+ return (
+ <Button
+ size="xs"
+ onClick={openExplorer}
+ tooltip="Inspect the DOM as it was at this moment in the session. Analyze the structure and elements captured during the recording."
+ disabledReason={
+ sessionPlayerMetaData?.snapshot_source === 'mobile' ? 'Only available for web recordings' : undefined
+ }
+ data-attr="explore-dom"
+ >
+ <IconSearch />
+ Inspect DOM
+ </Button>
+ )
+}
diff --git a/frontend/src/scenes/session-recordings/player/watch/QuillPlayerActionsMenu.tsx b/frontend/src/scenes/session-recordings/player/watch/QuillPlayerActionsMenu.tsx
new file mode 100644
index 000000000000..8dbc4420f1fd
--- /dev/null
+++ b/frontend/src/scenes/session-recordings/player/watch/QuillPlayerActionsMenu.tsx
@@ -0,0 +1,169 @@
+import { useActions, useValues } from 'kea'
+import { useState } from 'react'
+
+import { IconDownload, IconEllipsis, IconNotebook, IconTrash } from '@posthog/icons'
+import {
+ AlertDialog,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { getVideoExportDisabledReason } from 'lib/components/ExportButton/exportStatus'
+import { LemonMenuItems } from 'lib/lemon-ui/LemonMenu/LemonMenu'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { NotebookSelectButton } from 'scenes/notebooks/NotebookSelectButton/NotebookSelectButton'
+import { NotebookNodeType } from 'scenes/notebooks/types'
+import { sessionPlayerModalLogic } from 'scenes/session-recordings/player/modal/sessionPlayerModalLogic'
+import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'
+import {
+ SessionRecordingPlayerMode,
+ sessionRecordingPlayerLogic,
+} from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
+import { QuillMenuItems } from 'scenes/session-recordings/playlist/QuillMenuItems'
+import { personsModalLogic } from 'scenes/trends/persons-modal/personsModalLogic'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+function AddToNotebookItem(): JSX.Element {
+ const { sessionRecordingId } = useValues(sessionRecordingPlayerLogic)
+ const { setPause } = useActions(sessionRecordingPlayerLogic)
+ const { closeSessionPlayer } = useActions(sessionPlayerModalLogic())
+
+ return (
+ <span data-not-quill className="contents">
+ <NotebookSelectButton
+ fullWidth
+ size="xsmall"
+ icon={<IconNotebook />}
+ resource={{
+ type: NotebookNodeType.Recording,
+ attrs: { id: sessionRecordingId, __init: { expanded: true } },
+ }}
+ onClick={() => setPause()}
+ onNotebookOpened={() => {
+ closeSessionPlayer()
+ personsModalLogic.findMounted()?.actions.closeModal()
+ }}
+ >
+ Add to notebook
+ </NotebookSelectButton>
+ </span>
+ )
+}
+
+export function QuillPlayerActionsMenu({ extraItems = [] }: { extraItems?: LemonMenuItems }): JSX.Element {
+ const { logicProps, isMuted, hasReachedExportFullVideoLimit, sessionPlayerData } =
+ useValues(sessionRecordingPlayerLogic)
+ const { deleteRecording, setIsFullScreen, exportRecordingToFile, exportRecordingToVideoFile, setMuted } =
+ useActions(sessionRecordingPlayerLogic)
+ const { skipInactivitySetting } = useValues(playerSettingsLogic)
+ const { setSkipInactivitySetting } = useActions(playerSettingsLogic)
+ const [confirmDelete, setConfirmDelete] = useState(false)
+
+ const exportAccessControlDisabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.Export,
+ AccessControlLevel.Editor
+ )
+ const isStandardMode =
+ (logicProps.mode ?? SessionRecordingPlayerMode.Standard) === SessionRecordingPlayerMode.Standard
+ const tooLongToExportReason = getVideoExportDisabledReason(sessionPlayerData?.durationMs)
+ const exportLimitReason = hasReachedExportFullVideoLimit ? 'You have reached your export limit.' : undefined
+
+ const items: LemonMenuItems = [
+ { label: () => <AddToNotebookItem /> },
+ ...extraItems,
+ {
+ label: 'Skip inactivity',
+ tooltip: 'Skip inactive parts of the recording',
+ onClick: () => setSkipInactivitySetting(!skipInactivitySetting),
+ active: skipInactivitySetting,
+ 'data-attr': 'skip-inactivity-menu-item',
+ },
+ {
+ label: isMuted ? 'Unmute audio' : 'Mute audio',
+ onClick: () => setMuted(!isMuted),
+ active: false,
+ 'data-attr': 'mute-audio-menu-item',
+ },
+ isStandardMode && {
+ label: 'PostHog .json',
+ icon: <IconDownload />,
+ onClick: () => exportRecordingToFile(),
+ tooltip:
+ 'Export PostHog recording data to a JSON file. This can be loaded later into PostHog for playback.',
+ disabledReason: exportAccessControlDisabledReason ?? undefined,
+ 'data-attr': 'replay-export-posthog-json',
+ },
+ isStandardMode && {
+ label: 'Export to MP4',
+ icon: <IconDownload />,
+ onClick: () => exportRecordingToVideoFile(),
+ tooltip: exportLimitReason ?? 'Export PostHog recording data to MP4 video file.',
+ disabledReason:
+ exportLimitReason ?? tooLongToExportReason ?? exportAccessControlDisabledReason ?? undefined,
+ 'data-attr': 'replay-export-mp4',
+ },
+ isStandardMode &&
+ logicProps.playerKey !== 'modal' && {
+ label: 'Delete recording',
+ status: 'danger',
+ icon: <IconTrash />,
+ onClick: () => {
+ setIsFullScreen(false)
+ setConfirmDelete(true)
+ },
+ disabledReason: getAccessControlDisabledReason(
+ AccessControlResourceType.SessionRecording,
+ AccessControlLevel.Editor
+ ),
+ 'data-attr': 'replay-delete-recording',
+ },
+ ]
+
+ return (
+ <>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={<Button size="icon-xs" aria-label="More actions" data-attr="player-meta-more-menu" />}
+ >
+ <IconEllipsis />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <QuillMenuItems items={items} />
+ </DropdownMenuContent>
+ </DropdownMenu>
+ <AlertDialog open={confirmDelete} onOpenChange={setConfirmDelete}>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Delete recording</AlertDialogTitle>
+ <AlertDialogDescription>
+ Are you sure you want to delete this recording? This cannot be undone.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <Button variant="outline" onClick={() => setConfirmDelete(false)}>
+ Cancel
+ </Button>
+ <Button
+ variant="destructive"
+ onClick={() => {
+ setConfirmDelete(false)
+ deleteRecording()
+ }}
+ data-attr="replay-delete-recording-confirm"
+ >
+ Delete
+ </Button>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </>
+ )
+}
diff --git a/frontend/src/scenes/session-recordings/player/watch/QuillPlayerShareMenu.tsx b/frontend/src/scenes/session-recordings/player/watch/QuillPlayerShareMenu.tsx
new file mode 100644
index 000000000000..726bb63e1f39
--- /dev/null
+++ b/frontend/src/scenes/session-recordings/player/watch/QuillPlayerShareMenu.tsx
@@ -0,0 +1,98 @@
+import { useActions, useValues } from 'kea'
+
+import { IconExternal, IconGlobe, IconShare, IconShield } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from '@posthog/quill'
+
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { newInternalTab } from 'lib/utils/newInternalTab'
+import { sessionPlayerModalLogic } from 'scenes/session-recordings/player/modal/sessionPlayerModalLogic'
+import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
+import { openPlayerShareDialog } from 'scenes/session-recordings/player/share/PlayerShare'
+import { PlayerShareLogicProps } from 'scenes/session-recordings/player/share/playerShareLogic'
+import { QuillMenuItems } from 'scenes/session-recordings/playlist/QuillMenuItems'
+import { urls } from 'scenes/urls'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+export function QuillPlayerShareMenu(): JSX.Element {
+ const { sessionRecordingId, logicProps } = useValues(sessionRecordingPlayerLogic)
+ const { setPause, setIsFullScreen } = useActions(sessionRecordingPlayerLogic)
+ const { closeSessionPlayer } = useActions(sessionPlayerModalLogic())
+ const sharingDisabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.SharingConfiguration,
+ AccessControlLevel.Viewer
+ )
+ const notLoadedReason = !sessionRecordingId ? 'Recording not loaded yet' : undefined
+
+ // Read at call time: subscribing to the player time would re-render the menu on every tick.
+ const getCurrentPlayerTime = (): number => {
+ const playerTime = sessionRecordingPlayerLogic.findMounted(logicProps)?.values.currentPlayerTime || 0
+ return Math.floor(playerTime / 1000)
+ }
+
+ const onShare = (shareType: PlayerShareLogicProps['shareType']): void => {
+ setPause()
+ setIsFullScreen(false)
+ openPlayerShareDialog({ seconds: getCurrentPlayerTime(), id: sessionRecordingId, shareType })
+ }
+
+ const onOpenInNewTab = (): void => {
+ setPause()
+ setIsFullScreen(false)
+ closeSessionPlayer()
+ newInternalTab(urls.replaySingle(sessionRecordingId))
+ }
+
+ const onOpenInBrowserTab = (): void => {
+ const path = urls.replaySingle(sessionRecordingId)
+ const timestamp = getCurrentPlayerTime()
+ const separator = path.includes('?') ? '&' : '?'
+ window.open(
+ `${window.location.origin}${path}${timestamp ? `${separator}t=${timestamp}` : ''}`,
+ '_blank',
+ 'noopener,noreferrer'
+ )
+ }
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger render={<Button size="xs" data-attr="session-recording-share-button" />}>
+ <IconShare />
+ Share
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <QuillMenuItems
+ items={[
+ {
+ label: 'Open in new tab',
+ icon: <IconExternal />,
+ onClick: onOpenInNewTab,
+ disabledReason: notLoadedReason,
+ 'data-attr': 'open-in-new-tab',
+ },
+ {
+ label: 'Open in new browser tab',
+ icon: <IconExternal />,
+ onClick: onOpenInBrowserTab,
+ disabledReason: notLoadedReason,
+ 'data-attr': 'open-in-browser-tab',
+ },
+ {
+ label: 'Share private link',
+ icon: <IconShield />,
+ onClick: () => onShare('private'),
+ 'data-attr': 'share-private-link',
+ },
+ {
+ label: 'Share public link',
+ icon: <IconGlobe />,
+ onClick: () => onShare('public'),
+ disabledReason: sharingDisabledReason ?? undefined,
+ 'data-attr': 'share-public-link',
+ },
+ ]}
+ />
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/frontend/src/scenes/session-recordings/player/watch/QuillSetPlaybackSpeed.tsx b/frontend/src/scenes/session-recordings/player/watch/QuillSetPlaybackSpeed.tsx
new file mode 100644
index 000000000000..f4e8e827b42e
--- /dev/null
+++ b/frontend/src/scenes/session-recordings/player/watch/QuillSetPlaybackSpeed.tsx
@@ -0,0 +1,51 @@
+import { useActions, useValues } from 'kea'
+
+import { IconRabbit, IconTortoise } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from '@posthog/quill'
+
+import { humanFriendlyDuration } from 'lib/utils/durations'
+import {
+ PLAYBACK_SPEEDS,
+ sessionRecordingPlayerLogic,
+} from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
+import { QuillMenuItems } from 'scenes/session-recordings/playlist/QuillMenuItems'
+
+export function QuillSetPlaybackSpeed(): JSX.Element {
+ const { speed, sessionPlayerData } = useValues(sessionRecordingPlayerLogic)
+ const { setSpeed } = useActions(sessionRecordingPlayerLogic)
+ const Icon = speed === 0.5 ? IconTortoise : IconRabbit
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ size="xs"
+ variant={speed === 1 ? 'default' : 'secondary'}
+ data-attr="session-recording-speed-select"
+ />
+ }
+ >
+ <Icon className="text-lg" style={{ stroke: 'currentColor', strokeWidth: '0.5' }} />
+ Speed {speed}x
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <QuillMenuItems
+ items={PLAYBACK_SPEEDS.map((speedToggle) => ({
+ label: (
+ <span className="flex w-full justify-between gap-2">
+ <span>{speedToggle}x</span>
+ <span className="text-muted-foreground">
+ ({humanFriendlyDuration(sessionPlayerData.durationMs / speedToggle / 1000)})
+ </span>
+ </span>
+ ),
+ onClick: () => setSpeed(speedToggle),
+ active: speed === speedToggle,
+ 'data-attr': `speed-${speedToggle}x`,
+ }))}
+ />
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}