: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
export interface PlayerFrameDimensions {
width: number
height: number
}
export interface PlayerFrameScale {
scale: number
transform: string | null
}
// iPadOS 13+ reports a Mac user agent.
export function isIOS(): boolean {
if (typeof navigator === 'undefined') {
return false
}
const ua = navigator.userAgent
return /iPad|iPhone|iPod/.test(ua) || (/Macintosh/.test(ua) && navigator.maxTouchPoints > 1)
}
// Not `zoom`: WebKit propagates it into the iframe (#91417).
export function getPlayerFrameScale(parent: PlayerFrameDimensions, recorded: PlayerFrameDimensions): PlayerFrameScale {
const scale = Math.min(parent.width / recorded.width, parent.height / recorded.height, 1)
// Chrome clips wrongly under an identity transform.
return { scale, transform: scale === 1 ? null : `scale(${scale})` }
}