Skip to content

Commit e60194a

Browse files
committed
gui: default chromecast watcher ctx
1 parent 4244b51 commit e60194a

4 files changed

Lines changed: 3 additions & 24 deletions

File tree

internal/gui/actions.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ func chromecastPlayAction(screen *FyneScreen, actionID uint64) {
11341134

11351135
var mediaURL string
11361136
var mediaType string
1137-
var serverStoppedCTX context.Context
1137+
serverStoppedCTX := context.Background()
11381138

11391139
if screen.ExternalMediaURL.Checked {
11401140
mediaURL = screen.MediaText.Text
@@ -1806,7 +1806,7 @@ func skipToMediaPathAction(screen *FyneScreen, mediaPath string) {
18061806
// Determine if transcoding is enabled
18071807
transcode := screen.Transcode
18081808
ffmpegSeek := 0
1809-
var serverStoppedCTX context.Context
1809+
serverStoppedCTX := context.Background()
18101810

18111811
// Chromecast handles images and audio natively - never transcode these
18121812
mediaTypeSlice := strings.Split(mediaType, "/")
@@ -1917,7 +1917,6 @@ func skipToMediaPathAction(screen *FyneScreen, mediaPath string) {
19171917

19181918
// Set state to Waiting to ensure status watcher triggers UI update when playing starts
19191919
screen.updateScreenState("Waiting")
1920-
serverStoppedCTX = normalizeChromecastWatcherContext(serverStoppedCTX)
19211920

19221921
if client == nil || !client.IsConnected() {
19231922
return

internal/gui/actions_mobile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ func chromecastPlayAction(screen *FyneScreen, actionID uint64) {
702702

703703
var mediaURL string
704704
var mediaType string
705-
var serverStoppedCTX context.Context
705+
serverStoppedCTX := context.Background()
706706

707707
if screen.ExternalMediaURL.Checked {
708708
mediaURL = screen.MediaText.Text

internal/gui/chromecast_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@ import (
1111
"fyne.io/fyne/v2/widget"
1212
)
1313

14-
func TestNormalizeChromecastWatcherContextUsesBackground(t *testing.T) {
15-
if normalizeChromecastWatcherContext(nil) == nil {
16-
t.Fatal("expected fallback context")
17-
}
18-
19-
ctx := t.Context()
20-
21-
if got := normalizeChromecastWatcherContext(ctx); got != ctx {
22-
t.Fatal("expected existing context to be preserved")
23-
}
24-
}
25-
2614
func TestNextChromecastActionIDAdvancesGeneration(t *testing.T) {
2715
screen := &FyneScreen{chromecastActionID: 21}
2816

internal/gui/gui.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -637,14 +637,6 @@ func (p *FyneScreen) isChromecastActionCurrent(actionID uint64) bool {
637637
return p.chromecastActionID == actionID
638638
}
639639

640-
func normalizeChromecastWatcherContext(ctx context.Context) context.Context {
641-
if ctx != nil {
642-
return ctx
643-
}
644-
645-
return context.Background()
646-
}
647-
648640
func chromecastDeviceHost(device devType) string {
649641
if device.deviceType != devices.DeviceTypeChromecast || device.addr == "" {
650642
return ""

0 commit comments

Comments
 (0)