Add unified player Stop
This commit is contained in:
parent
1a3708409d
commit
8327385393
|
|
@ -388,6 +388,24 @@ func (p *UnifiedPlayer) Close() {
|
||||||
p.audioBuffer = nil
|
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
|
// Helper methods
|
||||||
|
|
||||||
// startVideoProcess starts the video processing goroutine
|
// startVideoProcess starts the video processing goroutine
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user