fix behavior of switching players while paused

This commit is contained in:
Drew Weymouth
2025-04-05 10:57:19 -07:00
parent 6e7480f48a
commit 28baf912f2
8 changed files with 57 additions and 37 deletions
+2 -2
View File
@@ -443,7 +443,7 @@ func (a *NowPlayingPage) Reload() {
}
switch a.tabs.SelectedIndex() {
case 1: /*lyrics*/
a.lastPlayPos = a.pm.PlayerStatus().TimePos
a.lastPlayPos = a.pm.PlaybackStatus().TimePos
a.updateLyrics()
case 2: /*related*/
a.updateRelatedList()
@@ -527,7 +527,7 @@ func (a *NowPlayingPage) saveSelectedTab(tabNum int) {
func (a *NowPlayingPage) formatStatusLine() {
curPlayer := a.pm.CurrentPlayer()
playerStats := a.pm.PlayerStatus()
playerStats := a.pm.PlaybackStatus()
lastStatus := a.statusLabel.Text
stopped := lang.L("Stopped")
state := stopped
+8 -1
View File
@@ -155,6 +155,9 @@ func (m *Controller) ShowCastMenu(onPendingPlayerChange func()) {
rp := m.App.PlaybackManager.CurrentRemotePlayer()
devices := m.App.PlaybackManager.RemotePlayers()
local := fyne.NewMenuItem(lang.L("This computer"), func() {
if rp == nil {
return // no-op. already not casting
}
onPendingPlayerChange()
go func() {
if err := m.App.PlaybackManager.SetRemotePlayer(nil); err != nil {
@@ -168,7 +171,11 @@ func (m *Controller) ShowCastMenu(onPendingPlayerChange func()) {
menu := fyne.NewMenu("", local)
for _, d := range devices {
_d := d
isCurrent := rp != nil && _d.URL == rp.URL
item := fyne.NewMenuItem(d.Name, func() {
if isCurrent {
return // no-op.
}
onPendingPlayerChange()
go func() {
if err := m.App.PlaybackManager.SetRemotePlayer(&_d); err != nil {
@@ -177,7 +184,7 @@ func (m *Controller) ShowCastMenu(onPendingPlayerChange func()) {
}()
})
item.Icon = myTheme.CastIcon
item.Checked = rp != nil && _d.URL == rp.URL
item.Checked = isCurrent
menu.Items = append(menu.Items, item)
}
pop := widget.NewPopUpMenu(menu, m.MainWindow.Canvas())