Skip to content

Commit

Permalink
fixing some jank
Browse files Browse the repository at this point in the history
  • Loading branch information
sphinxrave committed Jul 7, 2024
1 parent 87dece3 commit 361deaf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ export const WaveformEditor = ({ videoId }: { videoId: string }) => {
}}
/>
</div>
<div className="relative shrink grow" ref={containerRef}>
<div
className="relative max-w-full shrink grow overflow-hidden"
ref={containerRef}
>
{currentSubs.map((subtitle, index) => (
<Rnd
key={subtitle.key}
key={subtitle.id}
position={{
x: timeToPosition(subtitle.video_offset),
y: 15,
Expand Down
10 changes: 6 additions & 4 deletions packages/react/src/components/tldex/new-editor/hooks/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const useTimelineRendererBase = (
if (node !== null) {
const t = new Timeline(node, {
// Timeline configuration...\
fps: 120,
fps: 60,
maxZoom: 8,
minZoom: 1,
fill: true,
Expand Down Expand Up @@ -73,7 +73,9 @@ export const useTimelineRendererBase = (
const x = timelineRef.current.draw({
currentTime: videoStatus
? videoStatus.progress +
(Date.now() - videoStatus.progressRecordedAt) / 1000
(videoStatus?.status == "playing"
? (Date.now() - videoStatus.progressRecordedAt) / 1000
: 0)
: 0,
waveform,
});
Expand All @@ -86,8 +88,8 @@ export const useTimelineRendererBase = (
? videoStatus?.status == "playing"
? 15
: videoStatus?.status == "paused" || videoStatus?.status == "stopped"
? null
: 100
? 400
: 400
: null,
);

Expand Down

0 comments on commit 361deaf

Please sign in to comment.