{
+ evt.stopPropagation()
+ setInteractingViaKeypress(false)
+ }}
+ onMouseEnter={onMouseEnter}
+ onMouseLeave={onMouseLeave}
+ onFocus={onFocus}
+ onBlur={onBlur}
+ onKeyDown={onKeyDown}>
+
+
+
+
+
+ {formatTime(currentTime)} / {formatTime(duration)}
+
+ {hasSubtitleTrack && (
+
+ )}
+
+ {!isIPhoneWeb && (
+
+ )}
+
+ {(showControls || !focused) && (
+
+ {duration > 0 && (
+
+ )}
+
+ )}
+ {(buffering || error) && (
+
+ {buffering && }
+ {error && (
+
+ An error occurred
+
+ )}
+
+ )}
+
+ )
+}
+
+const btnProps = {
+ variant: 'ghost',
+ shape: 'round',
+ size: 'medium',
+ style: a.p_2xs,
+ hoverStyle: {backgroundColor: 'rgba(255, 255, 255, 0.1)'},
+} as const
+
+function formatTime(time: number) {
+ if (isNaN(time)) {
+ return '--'
+ }
+
+ time = Math.round(time)
+
+ const minutes = Math.floor(time / 60)
+ const seconds = String(time % 60).padStart(2, '0')
+
+ return `${minutes}:${seconds}`
+}
+
+function useVideoUtils(ref: React.RefObject