Skip to content
This repository has been archived by the owner on Jul 14, 2024. It is now read-only.

Commit

Permalink
readded seek buttons and vercel support
Browse files Browse the repository at this point in the history
  • Loading branch information
Aijazmakerb committed Jan 13, 2024
1 parent b44b8dc commit ed3dc3c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
46 changes: 46 additions & 0 deletions components/watch/new-player/components/buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import {
VolumeHighIcon,
VolumeLowIcon,
PreviousIcon,
SeekForward10Icon,
SeekBackward10Icon,
} from "@vidstack/react/icons";
import { useRouter } from "next/router";
import { Navigation } from "../player";
Expand Down Expand Up @@ -64,6 +66,50 @@ export function Play({ tooltipPlacement }: MediaButtonProps) {
);
}

export function SeekForwardButton({
tooltipPlacement
}: MediaButtonProps) {
const currentTime = useMediaState("currentTime");
const remote = useMediaRemote();
return (
<Tooltip.Root>
<Tooltip.Trigger asChild>
<button
className={buttonClass}
onClick={() => { remote.seek(currentTime + 10) }}
>
<SeekForward10Icon className="w-8 h-8" />
</button>
</Tooltip.Trigger>
<Tooltip.Content className={tooltipClass} placement={tooltipPlacement}>
Forward 10 Seconds
</Tooltip.Content>
</Tooltip.Root>
)
}

export function SeekBackwardButton({
tooltipPlacement
}: MediaButtonProps) {
const currentTime = useMediaState("currentTime");
const remote = useMediaRemote();
return (
<Tooltip.Root>
<Tooltip.Trigger asChild>
<button
className={buttonClass}
onClick={() => { remote.seek(currentTime - 10) }}
>
<SeekForward10Icon className="w-8 h-8" />
</button>
</Tooltip.Trigger>
<Tooltip.Content className={tooltipClass} placement={tooltipPlacement}>
Backward 10 Seconds
</Tooltip.Content>
</Tooltip.Root>
)
}

export function NextEpisode({
tooltipPlacement,
navigation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ export function VideoLayout({
{!!track?.subtitles?.length && (
<Buttons.Caption tooltipPlacement="top" />
)}
<Buttons.SeekBackwardButton tooltipPlacement="top" />
<Buttons.SeekForwardButton tooltipPlacement="top" />
<div className="ml-4"/>
<Menus.Settings placement="top end" tooltipPlacement="top" />
{!isMobile && !isFullscreen && (
<Buttons.TheaterButton tooltipPlacement="top" />
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"founder": "Factiven",
"scripts": {
"dev": "next dev",
"build": "next build",
"build": "npx prisma generate && next build",
"export": "next build && next export",
"start": "next start",
"type-check": "tsc",
Expand Down

0 comments on commit ed3dc3c

Please sign in to comment.