forked from Leak_Technologies/VideoTools
Guard player view render and refresh after loads
This commit is contained in:
parent
9d255680bf
commit
8479bfef6f
96
main.go
96
main.go
|
|
@ -163,44 +163,46 @@ func (c convertConfig) CoverLabel() string {
|
|||
}
|
||||
|
||||
type appState struct {
|
||||
window fyne.Window
|
||||
active string
|
||||
lastModule string
|
||||
source *videoSource
|
||||
loadedVideos []*videoSource // Multiple loaded videos for navigation
|
||||
currentIndex int // Current video index in loadedVideos
|
||||
anim *previewAnimator
|
||||
convert convertConfig
|
||||
currentFrame string
|
||||
player player.Controller
|
||||
playerReady bool
|
||||
playerVolume float64
|
||||
playerMuted bool
|
||||
lastVolume float64
|
||||
playerPaused bool
|
||||
playerPos float64
|
||||
playerLast time.Time
|
||||
compareSess1 *playSession
|
||||
compareSess2 *playSession
|
||||
lastSourcePath string
|
||||
progressQuit chan struct{}
|
||||
convertCancel context.CancelFunc
|
||||
playerSurf *playerSurface
|
||||
convertBusy bool
|
||||
convertStatus string
|
||||
convertActiveIn string
|
||||
convertActiveOut string
|
||||
convertProgress float64
|
||||
playSess *playSession
|
||||
jobQueue *queue.Queue
|
||||
statsBar *ui.ConversionStatsBar
|
||||
queueBtn *widget.Button
|
||||
queueScroll *container.Scroll
|
||||
queueOffset fyne.Position
|
||||
compareFile1 *videoSource
|
||||
compareFile2 *videoSource
|
||||
keyframingMode bool // Toggle for frame-accurate editing features
|
||||
isFullscreen bool // Fullscreen mode state
|
||||
window fyne.Window
|
||||
active string
|
||||
lastModule string
|
||||
source *videoSource
|
||||
loadedVideos []*videoSource // Multiple loaded videos for navigation
|
||||
currentIndex int // Current video index in loadedVideos
|
||||
anim *previewAnimator
|
||||
convert convertConfig
|
||||
currentFrame string
|
||||
player player.Controller
|
||||
playerReady bool
|
||||
playerVolume float64
|
||||
playerMuted bool
|
||||
lastVolume float64
|
||||
playerPaused bool
|
||||
playerPos float64
|
||||
playerLast time.Time
|
||||
compareSess1 *playSession
|
||||
compareSess2 *playSession
|
||||
lastSourcePath string
|
||||
playerViewSource string
|
||||
renderingPlayerView bool
|
||||
progressQuit chan struct{}
|
||||
convertCancel context.CancelFunc
|
||||
playerSurf *playerSurface
|
||||
convertBusy bool
|
||||
convertStatus string
|
||||
convertActiveIn string
|
||||
convertActiveOut string
|
||||
convertProgress float64
|
||||
playSess *playSession
|
||||
jobQueue *queue.Queue
|
||||
statsBar *ui.ConversionStatsBar
|
||||
queueBtn *widget.Button
|
||||
queueScroll *container.Scroll
|
||||
queueOffset fyne.Position
|
||||
compareFile1 *videoSource
|
||||
compareFile2 *videoSource
|
||||
keyframingMode bool // Toggle for frame-accurate editing features
|
||||
isFullscreen bool // Fullscreen mode state
|
||||
}
|
||||
|
||||
func (s *appState) stopPreview() {
|
||||
|
|
@ -578,7 +580,18 @@ func (s *appState) buildComparePane(src *videoSource, onStop func(), setSess fun
|
|||
// showPlayerView renders the player-focused UI with a lightweight playlist.
|
||||
func (s *appState) showPlayerView() {
|
||||
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")
|
||||
return
|
||||
}
|
||||
|
|
@ -669,6 +682,7 @@ func (s *appState) showPlayerView() {
|
|||
// Player area
|
||||
var playerArea fyne.CanvasObject
|
||||
if s.source == nil {
|
||||
s.playerViewSource = ""
|
||||
bg := canvas.NewRectangle(utils.MustHex("#05070C"))
|
||||
bg.SetMinSize(fyne.NewSize(960, 540))
|
||||
|
||||
|
|
@ -718,6 +732,7 @@ func (s *appState) showPlayerView() {
|
|||
s.setContent(playerArea)
|
||||
} else {
|
||||
src := s.source
|
||||
s.playerViewSource = src.Path
|
||||
fmt.Printf("🎬 Creating player view for loaded video\n")
|
||||
|
||||
// Image surface
|
||||
|
|
@ -4491,6 +4506,7 @@ func (s *appState) loadVideo(path string) {
|
|||
fmt.Printf("🔄 Switching to player view...\n")
|
||||
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||
s.switchToVideo(s.currentIndex)
|
||||
s.showPlayerView()
|
||||
}, false)
|
||||
}
|
||||
|
||||
|
|
@ -4508,6 +4524,7 @@ func (s *appState) clearVideo() {
|
|||
s.convert.AspectHandling = "Auto"
|
||||
s.convert.OutputAspect = "Source"
|
||||
s.lastSourcePath = ""
|
||||
s.playerViewSource = ""
|
||||
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||
s.showPlayerView()
|
||||
}, false)
|
||||
|
|
@ -4614,6 +4631,7 @@ func (s *appState) loadVideos(paths []string) {
|
|||
s.currentIndex = 0
|
||||
fyne.Do(func() {
|
||||
s.switchToVideo(0)
|
||||
s.showPlayerView()
|
||||
})
|
||||
}()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user