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
51 lines
1.6 KiB
Go
51 lines
1.6 KiB
Go
package dialog
|
|
|
|
import (
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/theme"
|
|
"fyne.io/fyne/v2/widget"
|
|
)
|
|
|
|
const (
|
|
// absolute max width of text dialogs
|
|
// (prevent them from looking unnaturally large on desktop)
|
|
maxTextDialogAbsoluteWidth float32 = 600
|
|
|
|
// max width of text dialogs as a percentage of the current window width
|
|
maxTextDialogWinPcntWidth float32 = .9
|
|
)
|
|
|
|
func newTextDialog(title, message string, icon fyne.Resource, parent fyne.Window) *dialog {
|
|
d := &dialog{
|
|
title: title,
|
|
icon: icon,
|
|
parent: parent,
|
|
content: newCenterWrappedLabel(message),
|
|
}
|
|
d.beforeShowHook = createBeforeShowHook(d, message)
|
|
|
|
return d
|
|
}
|
|
|
|
// returns a beforeShowHook that sets the desired width of the dialog to the min of:
|
|
// - width needed to show message without wrapping
|
|
// - maxTextDialogAbsoluteWidth
|
|
// - current window width * maxTextDialogWinPcntWidth
|
|
func createBeforeShowHook(d *dialog, message string) func() {
|
|
// Until issue #4648 is resolved, we need to create a label here
|
|
// rather than just using fyne.MeasureText, because the label's minsize
|
|
// also depends on the internal padding that label adds, which is unknown here
|
|
noWrapWidth := widget.NewLabel(message).MinSize().Width + padWidth + theme.Padding()*2
|
|
return func() {
|
|
if d.desiredSize.IsZero() {
|
|
maxWinWitth := d.parent.Canvas().Size().Width * maxTextDialogWinPcntWidth
|
|
w := fyne.Min(fyne.Min(noWrapWidth, maxTextDialogAbsoluteWidth), maxWinWitth)
|
|
d.desiredSize = fyne.NewSize(w, d.MinSize().Height)
|
|
}
|
|
}
|
|
}
|
|
|
|
func newCenterWrappedLabel(message string) fyne.CanvasObject {
|
|
return &widget.Label{Text: message, Alignment: fyne.TextAlignCenter, Wrapping: fyne.TextWrapWord}
|
|
}
|