Limeplay - Open Source Video Player UI ComponentsLimeplay

use-timeline

Feature for managing playback position, seeking, and buffered ranges.

Installation

npx shadcn add @limeplay/use-timeline

Register the feature:

lib/media.ts
"use client"

import { timelineFeature } from "@/hooks/limeplay/use-timeline"

createMediaKit({
  features: [..., timelineFeature()] as const,
})

Store

Access via useTimelineStore(selector):

import { useTimelineStore } from "@/hooks/limeplay/use-timeline"

const currentTime = useTimelineStore((s) => s.currentTime)
const duration = useTimelineStore((s) => s.duration)
const progress = useTimelineStore((s) => s.progress)
const seek = useTimelineStore((s) => s.seek)

State

FieldTypeDescription
currentTimenumberCurrent playback time (seconds)
durationnumberTotal duration (seconds)
progressnumberPlayback progress (0–1)
hoveringTimenumberTime at hover position (seconds)
isHoveringbooleanWhether user is hovering the timeline
isLivebooleanWhether stream is live
liveLatencynumber | nullSeconds behind live edge
bufferedBufferedRange[]Array of buffered time ranges

Actions

MethodDescription
seek(time)Seek to specific time
setHoveringTime(time)Set the hover preview time
setIsHovering(isHovering)Set hover state
processBufferedRanges(ranges, variant?)Process ranges for UI rendering

Buffered Range Variants

processBufferedRanges supports three display modes:

  • "default" — Raw buffered ranges as-is
  • "combined" — Merged into a single range
  • "from-zero" — Extends first range start to zero

Live Stream Support

For live streams, the timeline uses Shaka Player's seekRange() for proper DVR seeking. Progress is calculated relative to the seek window, and liveLatency tracks how far behind the live edge.

Events

EventPayloadWhen
timeupdate{ currentTime, duration, progress }Position updates (polled)
durationchange{ duration }Duration changes
seek{ from, to }User seeks

API Reference

Prop

Type

On this page