解决部分已知bug
This commit is contained in:
@@ -71,7 +71,7 @@ func (tts *AliTTS) getToken() error {
|
||||
|
||||
func (tts *AliTTS) Get(text string) (io.Reader, error) {
|
||||
param := nls.DefaultSpeechSynthesisParam()
|
||||
param.Volume = 200
|
||||
param.Volume = tts.Volume
|
||||
param.Voice = tts.Voice
|
||||
param.SpeechRate = tts.SpeechRate
|
||||
|
||||
|
||||
@@ -64,7 +64,9 @@ func LinkAudio(link string) (bgm io.ReadCloser, err error) {
|
||||
} else {
|
||||
err = fmt.Errorf("不支持的链接协议: %v", u.String())
|
||||
}
|
||||
bgm = toSeeker(bgm)
|
||||
if bgm != nil {
|
||||
bgm = toSeeker(bgm)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user