Skip to content

Commit

Permalink
video selection on side, playback rate fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-laverty committed Jan 19, 2025
1 parent 2ba5b20 commit 12b20d8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 35 deletions.
16 changes: 8 additions & 8 deletions app/(sidebar)/session/[sessionId]/components/video-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ export default function VideoContainer({ clips, session }: VideoContainerProps)
return (
<div className="flex flex-col justify-between md:mx-auto p-4 max-w-fit">

<div className="flex justify-center gap-4">
<div className="flex justify-center gap-4 max-h-[720px]">

<div className="flex flex-col rounded-xl max-w-screen-md pb-2 bg-background">
<VideoHeader session={session} />
<VideoPlayer title={selectedVideo ? selectedVideo.title : ''} />
<VideoList
videos={clips}
selectedVideo={selectedVideo}
onSelectVideo={handleSelectVideo}
/>
</div>

<CommentsSection
<VideoList
videos={clips}
selectedVideo={selectedVideo}
onSelectVideo={handleSelectVideo}
/>
{/* <CommentsSection
className="rounded-xl"
comments={comments}
addComment={addComment}
/>
/> */}
</div>

</div>
Expand Down
6 changes: 3 additions & 3 deletions app/(sidebar)/session/[sessionId]/components/video-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ interface VideoListProps {
const VideoList: React.FC<VideoListProps> = ({ videos, selectedVideo, onSelectVideo }) => {
return (

<ScrollArea className="bg-background whitespace-nowrap">
<div className="p-2 space-x-2">
<ScrollArea className="bg-background rounded-lg">
<div className="p-4 gap-2 flex flex-col">
{videos.map((video, index) => (
<VideoThumbnail
key={index}
Expand All @@ -25,7 +25,7 @@ const VideoList: React.FC<VideoListProps> = ({ videos, selectedVideo, onSelectVi
/>
))}
</div>
<ScrollBar orientation="horizontal" />
<ScrollBar orientation="vertical" />
</ScrollArea>

);
Expand Down
61 changes: 37 additions & 24 deletions app/(sidebar)/session/[sessionId]/components/video-player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ import React, { useRef, useState, useEffect, ChangeEvent } from 'react';
import { Slider } from "@/components/ui/slider"
import { Button } from "@/components/ui/button"
import { Spinner } from "@/components/ui/spinner"
import { Play, Pause, StepBack, StepForward, Pencil, MessageSquarePlus } from "lucide-react";
import {
Play,
Pause,
StepBack,
StepForward,
Timer
} from "lucide-react";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";

interface VideoPlayerProps {
title: string;
Expand Down Expand Up @@ -115,6 +126,9 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({ title }) => {

const handlePlaybackRateChange = (newValue: number[]) => {
setPlaybackRate(newValue);
if (videoRef.current) {
videoRef.current.playbackRate = newValue[0];
}
};

const formatTime = (time: number): string => {
Expand Down Expand Up @@ -189,29 +203,28 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({ title }) => {
<StepForward size={18} />
</Button>


{/* <div className="space-x-2">
<Button variant="ghost" size="icon">
<Pencil />
</Button>
<Button variant="ghost" size="icon">
<MessageSquarePlus />
</Button>
</div> */}

{/* playback rate */}
{/* <div className="flex-shrink-0 w-32">
<div className="flex items-center space-x-2">
<Slider
defaultValue={playbackRate}
max={1}
step={0.01}
onValueChange={handlePlaybackRateChange}
/>
<div className="text-sm w-6 text-right">{playbackRate[0].toFixed(1)}x</div>
</div>
</div> */}
<Popover>
<PopoverTrigger asChild>
<Button
variant={"ghost"}
>
<Timer size={18} />
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0">
<div className="flex-shrink-0 w-32">
<div className="flex items-center space-x-2">
<Slider
defaultValue={playbackRate}
max={1}
step={0.01}
onValueChange={handlePlaybackRateChange}
/>
<div className="text-sm w-6 text-right">{playbackRate[0].toFixed(1)}x</div>
</div>
</div>
</PopoverContent>
</Popover>

</div>
</div>
Expand Down

0 comments on commit 12b20d8

Please sign in to comment.