fix: improve rrweb player dimensions and enable responsive scaling
This commit is contained in:
@@ -98,19 +98,25 @@ export default function ReplayViewerPage() {
|
|||||||
playerContainerRef.current.innerHTML = ''
|
playerContainerRef.current.innerHTML = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create player
|
// Calculate dimensions - use container width and maintain aspect ratio
|
||||||
|
const containerWidth = playerContainerRef.current!.clientWidth
|
||||||
|
const containerHeight = Math.max(500, Math.min(700, window.innerHeight - 300))
|
||||||
|
|
||||||
|
// Create player with proper scaling
|
||||||
const player = new rrwebPlayer.default({
|
const player = new rrwebPlayer.default({
|
||||||
target: playerContainerRef.current!,
|
target: playerContainerRef.current!,
|
||||||
props: {
|
props: {
|
||||||
events: replayData,
|
events: replayData,
|
||||||
width: playerContainerRef.current!.clientWidth,
|
width: containerWidth,
|
||||||
height: Math.min(600, window.innerHeight - 300),
|
height: containerHeight,
|
||||||
autoPlay: false,
|
autoPlay: false,
|
||||||
showController: true,
|
showController: true,
|
||||||
speed: speed,
|
speed: speed,
|
||||||
skipInactive: true,
|
skipInactive: true,
|
||||||
showWarning: false,
|
showWarning: false,
|
||||||
showDebug: false,
|
showDebug: false,
|
||||||
|
// Enable responsive scaling
|
||||||
|
UNSAFE_replayCanvas: false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -192,7 +198,7 @@ export default function ReplayViewerPage() {
|
|||||||
{/* Player Container */}
|
{/* Player Container */}
|
||||||
<div
|
<div
|
||||||
ref={playerContainerRef}
|
ref={playerContainerRef}
|
||||||
className="w-full bg-neutral-100 dark:bg-neutral-800 min-h-[400px] flex items-center justify-center"
|
className="w-full bg-neutral-100 dark:bg-neutral-800 min-h-[500px] flex items-center justify-center [&_.rr-player]:!w-full [&_.rr-player]:!max-w-full [&_.rr-player__frame]:!w-full [&_.replayer-wrapper]:!mx-auto"
|
||||||
>
|
>
|
||||||
{loadingData ? (
|
{loadingData ? (
|
||||||
<div className="flex flex-col items-center gap-3">
|
<div className="flex flex-col items-center gap-3">
|
||||||
|
|||||||
Reference in New Issue
Block a user