Major improvements to UnifiedPlayer: 1. GetFrameImage() now works when paused for responsive UI updates 2. Play() method properly starts FFmpeg process 3. Frame display loop runs continuously for smooth video display 4. Disabled audio temporarily to fix video playback fundamentals 5. Simplified FFmpeg command to focus on video stream only Player now: - Generates video frames correctly - Shows video when paused - Has responsive progress tracking - Starts playback properly Next steps: Re-enable audio playback once video is stable
36 lines
844 B
Go
36 lines
844 B
Go
package cache
|
|
|
|
import (
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/internal/async"
|
|
)
|
|
|
|
var canvases async.Map[fyne.CanvasObject, *canvasInfo]
|
|
|
|
// GetCanvasForObject returns the canvas for the specified object.
|
|
func GetCanvasForObject(obj fyne.CanvasObject) fyne.Canvas {
|
|
cinfo, ok := canvases.Load(obj)
|
|
if cinfo == nil || !ok {
|
|
return nil
|
|
}
|
|
cinfo.setAlive()
|
|
return cinfo.canvas
|
|
}
|
|
|
|
// SetCanvasForObject sets the canvas for the specified object.
|
|
// The passed function will be called if the item was not previously attached to this canvas
|
|
func SetCanvasForObject(obj fyne.CanvasObject, c fyne.Canvas, setup func()) {
|
|
cinfo := &canvasInfo{canvas: c}
|
|
cinfo.setAlive()
|
|
|
|
old, found := canvases.LoadOrStore(obj, cinfo)
|
|
if (!found || old.canvas != c) && setup != nil {
|
|
setup()
|
|
}
|
|
}
|
|
|
|
type canvasInfo struct {
|
|
expiringCache
|
|
canvas fyne.Canvas
|
|
}
|