解决部分已知bug

This commit is contained in:
2025-02-27 11:36:40 +08:00
parent 593d7758bf
commit 8780f8555e
14 changed files with 96 additions and 59 deletions

View File

@@ -5,6 +5,7 @@ import (
"context"
"go.uber.org/zap"
"io"
"os"
"os/exec"
"sync"
)
@@ -14,6 +15,11 @@ func Play(ctx context.Context, file string) error {
zap.S().Infoln("video file is empty")
return nil
}
// 判断文件是否存在
if _, err := os.Stat(file); err != nil {
zap.S().Errorf("视频文件不存在: %v", err)
return err
}
cmd := exec.CommandContext(ctx, "ffplay", "-autoexit", "-fs", file)
pipe, err := cmd.StderrPipe()
if err != nil {