Improve casting resume behavior
All checks were successful
Build on Push and create Release on Tag / build (push) Successful in 15m49s

This commit is contained in:
MassiveBox 2025-06-07 22:43:22 +02:00
parent 150348c391
commit 4cf9a2a58f
Signed by: massivebox
GPG key ID: 9B74D3A59181947D
3 changed files with 57 additions and 11 deletions

View file

@ -39,16 +39,10 @@ func (c *Controller) StartCasting(selected string, mediaURL string) {
return
}
err := c.Model.ConnectToDevice(selected)
if err != nil {
c.LogAndShowError(fmt.Errorf("error connecting to device %v", err))
return
}
go func() {
err = c.Model.StartCast(mediaURL)
err := c.Model.Cast(selected, mediaURL)
if err != nil {
c.LogAndShowError(fmt.Errorf("error starting cast %v", err))
c.DiscoverDevices()
c.LogAndShowError(fmt.Errorf("error starting cast: %v", err))
return
}
}()
@ -56,6 +50,10 @@ func (c *Controller) StartCasting(selected string, mediaURL string) {
}
func (c *Controller) ShowReconnecting(reconnecting bool) {
c.View.PopupReconnecting(reconnecting)
}
// Note: these are app codes, they are NOT related to fcast opcodes!
const (
ActionPlay = 0
@ -78,7 +76,6 @@ func (c *Controller) PlayerAction(action int, args ...float32) {
}
func (c *Controller) ExitCasting() {
c.PlayerAction(ActionStop)
c.DiscoverDevices()
}