forked from Leak_Technologies/VideoTools
Guard player view render and refresh after loads
This commit is contained in:
parent
9d255680bf
commit
8479bfef6f
20
main.go
20
main.go
|
|
@ -183,6 +183,8 @@ type appState struct {
|
||||||
compareSess1 *playSession
|
compareSess1 *playSession
|
||||||
compareSess2 *playSession
|
compareSess2 *playSession
|
||||||
lastSourcePath string
|
lastSourcePath string
|
||||||
|
playerViewSource string
|
||||||
|
renderingPlayerView bool
|
||||||
progressQuit chan struct{}
|
progressQuit chan struct{}
|
||||||
convertCancel context.CancelFunc
|
convertCancel context.CancelFunc
|
||||||
playerSurf *playerSurface
|
playerSurf *playerSurface
|
||||||
|
|
@ -578,7 +580,18 @@ func (s *appState) buildComparePane(src *videoSource, onStop func(), setSess fun
|
||||||
// showPlayerView renders the player-focused UI with a lightweight playlist.
|
// showPlayerView renders the player-focused UI with a lightweight playlist.
|
||||||
func (s *appState) showPlayerView() {
|
func (s *appState) showPlayerView() {
|
||||||
fmt.Printf("🎬 showPlayerView called\n")
|
fmt.Printf("🎬 showPlayerView called\n")
|
||||||
if s.active == "player" && s.source != nil && s.lastSourcePath == s.source.Path {
|
if s.renderingPlayerView {
|
||||||
|
fmt.Printf("⏳ player view render already in progress, skipping\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.renderingPlayerView = true
|
||||||
|
defer func() { s.renderingPlayerView = false }()
|
||||||
|
|
||||||
|
currentPath := ""
|
||||||
|
if s.source != nil {
|
||||||
|
currentPath = s.source.Path
|
||||||
|
}
|
||||||
|
if s.active == "player" && s.source != nil && s.playerViewSource == currentPath {
|
||||||
fmt.Printf("📺 already in player view for this source; skipping rebuild\n")
|
fmt.Printf("📺 already in player view for this source; skipping rebuild\n")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -669,6 +682,7 @@ func (s *appState) showPlayerView() {
|
||||||
// Player area
|
// Player area
|
||||||
var playerArea fyne.CanvasObject
|
var playerArea fyne.CanvasObject
|
||||||
if s.source == nil {
|
if s.source == nil {
|
||||||
|
s.playerViewSource = ""
|
||||||
bg := canvas.NewRectangle(utils.MustHex("#05070C"))
|
bg := canvas.NewRectangle(utils.MustHex("#05070C"))
|
||||||
bg.SetMinSize(fyne.NewSize(960, 540))
|
bg.SetMinSize(fyne.NewSize(960, 540))
|
||||||
|
|
||||||
|
|
@ -718,6 +732,7 @@ func (s *appState) showPlayerView() {
|
||||||
s.setContent(playerArea)
|
s.setContent(playerArea)
|
||||||
} else {
|
} else {
|
||||||
src := s.source
|
src := s.source
|
||||||
|
s.playerViewSource = src.Path
|
||||||
fmt.Printf("🎬 Creating player view for loaded video\n")
|
fmt.Printf("🎬 Creating player view for loaded video\n")
|
||||||
|
|
||||||
// Image surface
|
// Image surface
|
||||||
|
|
@ -4491,6 +4506,7 @@ func (s *appState) loadVideo(path string) {
|
||||||
fmt.Printf("🔄 Switching to player view...\n")
|
fmt.Printf("🔄 Switching to player view...\n")
|
||||||
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||||
s.switchToVideo(s.currentIndex)
|
s.switchToVideo(s.currentIndex)
|
||||||
|
s.showPlayerView()
|
||||||
}, false)
|
}, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4508,6 +4524,7 @@ func (s *appState) clearVideo() {
|
||||||
s.convert.AspectHandling = "Auto"
|
s.convert.AspectHandling = "Auto"
|
||||||
s.convert.OutputAspect = "Source"
|
s.convert.OutputAspect = "Source"
|
||||||
s.lastSourcePath = ""
|
s.lastSourcePath = ""
|
||||||
|
s.playerViewSource = ""
|
||||||
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||||
s.showPlayerView()
|
s.showPlayerView()
|
||||||
}, false)
|
}, false)
|
||||||
|
|
@ -4614,6 +4631,7 @@ func (s *appState) loadVideos(paths []string) {
|
||||||
s.currentIndex = 0
|
s.currentIndex = 0
|
||||||
fyne.Do(func() {
|
fyne.Do(func() {
|
||||||
s.switchToVideo(0)
|
s.switchToVideo(0)
|
||||||
|
s.showPlayerView()
|
||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user