Add unified player Stop

This commit is contained in:
Stu Leak 2026-01-04 07:51:14 -05:00
parent f1690c6b08
commit fa7068025c

View File

@ -388,6 +388,24 @@ func (p *UnifiedPlayer) Close() {
p.audioBuffer = nil
}
// Stop halts playback and tears down the FFmpeg process.
func (p *UnifiedPlayer) Stop() error {
p.mu.Lock()
defer p.mu.Unlock()
if p.cancel != nil {
p.cancel()
}
if p.cmd != nil && p.cmd.Process != nil {
_ = p.cmd.Process.Kill()
}
p.state = StateStopped
if p.stateCallback != nil {
p.stateCallback(p.state)
}
return nil
}
// Helper methods
// startVideoProcess starts the video processing goroutine