Compare commits
2 Commits
v1.0.2-rc3
...
v1.0.2-rc5
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d23c1704f | |||
| b5f7c823c8 |
@@ -40,6 +40,7 @@ func PlayWav(c context.Context, r io.Reader) {
|
|||||||
|
|
||||||
ctrl := &beep.Ctrl{Streamer: s}
|
ctrl := &beep.Ctrl{Streamer: s}
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
|
|
||||||
speaker.Play(beep.Seq(ctrl, beep.Callback(func() {
|
speaker.Play(beep.Seq(ctrl, beep.Callback(func() {
|
||||||
zap.S().Debugln("音频播放完成")
|
zap.S().Debugln("音频播放完成")
|
||||||
close(done)
|
close(done)
|
||||||
@@ -69,9 +70,9 @@ func PlayWav(c context.Context, r io.Reader) {
|
|||||||
currentTime := float64(pos) / float64(format.SampleRate)
|
currentTime := float64(pos) / float64(format.SampleRate)
|
||||||
zap.S().Debugf("播放进度: %d/%d (%.1f%%), %.2f秒", pos, totalSamples, progress, currentTime)
|
zap.S().Debugf("播放进度: %d/%d (%.1f%%), %.2f秒", pos, totalSamples, progress, currentTime)
|
||||||
lastPos = pos
|
lastPos = pos
|
||||||
} else {
|
} else if lastPos > 0 {
|
||||||
zap.S().Debugf("播放停滞在位置: %d/%d, Streamer状态: %v",
|
// 只有在已经开始播放后才报告停滞
|
||||||
pos, totalSamples, ctrl.Streamer != nil)
|
zap.S().Debugf("播放停滞在位置: %d/%d", pos, totalSamples)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user