do fast scan for remote players on startup
This commit is contained in:
+2
-2
@@ -153,7 +153,7 @@ func StartupApp(appName, displayAppName, appVersion, appVersionTag, latestReleas
|
||||
}
|
||||
|
||||
// Periodically scan for remote players
|
||||
go a.PlaybackManager.ScanRemotePlayers(a.bgrndCtx, 5 /*waitSec*/)
|
||||
go a.PlaybackManager.ScanRemotePlayers(a.bgrndCtx, true /*fastScan*/)
|
||||
go func() {
|
||||
t := time.NewTicker(5 * time.Minute)
|
||||
for {
|
||||
@@ -162,7 +162,7 @@ func StartupApp(appName, displayAppName, appVersion, appVersionTag, latestReleas
|
||||
t.Stop()
|
||||
return
|
||||
case <-t.C:
|
||||
a.PlaybackManager.ScanRemotePlayers(a.bgrndCtx, 10 /*waitSec*/)
|
||||
a.PlaybackManager.ScanRemotePlayers(a.bgrndCtx, false)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -96,7 +96,15 @@ func (p *PlaybackManager) addOnTrackChangeHook() {
|
||||
})
|
||||
}
|
||||
|
||||
func (p *PlaybackManager) ScanRemotePlayers(ctx context.Context, waitSec int) {
|
||||
func (p *PlaybackManager) ScanRemotePlayers(ctx context.Context, fastScan bool) {
|
||||
if fastScan {
|
||||
p.scanRemotePlayers(ctx, 1 /*waitSec*/)
|
||||
// continue to slow scan to detect players that take longer to respond
|
||||
}
|
||||
p.scanRemotePlayers(ctx, 10 /*waitSec*/)
|
||||
}
|
||||
|
||||
func (p *PlaybackManager) scanRemotePlayers(ctx context.Context, waitSec int) {
|
||||
devices, _ := device.SearchMediaRenderers(ctx, waitSec, services.AVTransport, services.RenderingControl)
|
||||
|
||||
var discovered []remotePlayer
|
||||
|
||||
Reference in New Issue
Block a user