Limeplay V2 in under heavy development 🥳 We are looking for contributors 👀
LimeplayLimeplay
Components

Timeline Labels

Timeline Labels provide semantic time display components for media players. These components automatically format time based on duration and provide proper accessibility attributes.

Installation

  1. Install the timeline-labels component:
npx shadcn add https://limeplay.winoffrg.dev/r/styles/default/timeline-labels.json
  1. Add Event & Action Bridge

Import the useMediaStates hook in your existing PlayerHooks component. This hook setups the required events and action bridge for the playback state control to work.

components/player/player-hooks.tsx
import React from "react"

import { useShakaPlayer } from "@/registry/default/hooks/use-shaka-player"
import { useTimelineStates } from "@/registry/default/hooks/use-timeline"

export const PlayerHooks = React.memo(() => {
  useShakaPlayer()
  useTimelineStates() 

  return null
})
  1. Add the Store States
lib/create-media-store.ts
import {
  createPlayerRootStore,
  PlayerRootStore,
} from "@/registry/default/hooks/use-player-root-store"
import {
  createTimelineStore,
  TimelineStore,
} from "@/registry/default/hooks/use-timeline"

export type TypeMediaStore = PlayerRootStore &
  TimelineStore & {} 

export function createMediaStore(initProps?: Partial<CreateMediaStoreProps>) {
  const mediaStore = create<TypeMediaStore>()((...etc) => ({
    ...createPlayerRootStore(...etc),
    ...createTimelineStore(...etc),
    ...initProps,
  }))
  return mediaStore
}

Components

  • <Elapsed /> component shows current playback time
  • <Remaining /> component shows remaining time (with minus sign)
  • <Duration /> component shows total media duration
  • <HoverTime /> component shows time at hover position on timeline