Compare commits

...

3 Commits

Author SHA1 Message Date
e2d8e17f62 Sun Mar 8 08:27:26 AM CST 2026 2026-03-08 08:27:26 +08:00
63486757b9 从claude code迁移到opencode 2026-03-06 09:29:08 +08:00
45ffe5733b 从claude code迁移到opencode 2026-03-06 09:28:27 +08:00
4 changed files with 13 additions and 5 deletions

2
.gitignore vendored
View File

@@ -51,4 +51,4 @@ test.js
certificates
.claude
.opencode

View File

@@ -1,8 +1,8 @@
# CLAUDE.md
# AGENTS.md
```bash
# 使用以下命令检查代码合法性
pnpm eslint
pnpm build
```

View File

@@ -12,7 +12,7 @@ import { getCurrentIndex } from "./subtitleParser";
export default function SRTPlayerPage() {
const videoRef = useRef<HTMLVideoElement>(null);
const { setVideoRef, currentSrc, loadVideo, loaded, getCurrentTime, getDuration, play, setOnTimeUpdate } = useVideoStore();
const { setVideoRef, pause, currentSrc, isPlaying, loadVideo, loaded, getCurrentTime, getDuration, play, setOnTimeUpdate } = useVideoStore();
const {
uploadVideo,
uploadSubtitle,
@@ -81,7 +81,9 @@ export default function SRTPlayerPage() {
/* 控制面板 */
sub.length > 0 && loaded &&
<HStack gap={2} className="mx-auto mt-4 w-[85%]" justify={"center"} wrap>
<LightButton onClick={play}>play</LightButton>
{isPlaying() ?
LightButton({ children: "pause", onClick: () => pause() }) :
LightButton({ children: "play", onClick: () => play() })}
<LightButton>previous</LightButton>
<LightButton>next</LightButton>
<LightButton>restart</LightButton>

View File

@@ -16,6 +16,7 @@ interface VideoStore {
setVolume: (vol: number) => void;
getCurrentTime: () => number | undefined;
getDuration: () => number | undefined;
isPlaying: () => boolean;
}
export const useVideoStore = create<VideoStore>()(
@@ -102,5 +103,10 @@ export const useVideoStore = create<VideoStore>()(
},
getCurrentTime: () => get().videoRef?.current?.currentTime,
getDuration: () => get().videoRef?.current?.duration,
isPlaying: () => {
const video = get().videoRef?.current;
if (!video) return false;
return !video.paused && !video.ended && video.readyState > 2;
}
}))
);