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
121 lines
1.7 KiB
Go
121 lines
1.7 KiB
Go
package widget
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/lang"
|
|
)
|
|
|
|
type weekday int
|
|
|
|
const (
|
|
monday weekday = iota // default
|
|
sunday
|
|
saturday
|
|
)
|
|
|
|
func (w weekday) String() string {
|
|
switch w {
|
|
case sunday:
|
|
return "Sunday"
|
|
case saturday:
|
|
return "Saturday"
|
|
default:
|
|
return "Monday"
|
|
}
|
|
}
|
|
|
|
type localeSetting struct {
|
|
dateFormat string
|
|
weekStartDay weekday
|
|
}
|
|
|
|
const defaultDateFormat = "02/01/2006"
|
|
|
|
var localeSettings = map[string]localeSetting{
|
|
"": {
|
|
dateFormat: defaultDateFormat,
|
|
weekStartDay: monday,
|
|
},
|
|
"BR": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"BZ": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"CA": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"CO": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"DE": {
|
|
dateFormat: "02.01.2006",
|
|
},
|
|
"DO": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"GT": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"JP": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"MX": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"NI": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"PE": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"PA": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"PY": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"SE": {
|
|
dateFormat: "2006-01-02",
|
|
},
|
|
"US": {
|
|
dateFormat: "01/02/2006",
|
|
weekStartDay: sunday,
|
|
},
|
|
"VE": {
|
|
weekStartDay: sunday,
|
|
},
|
|
"ZA": {
|
|
weekStartDay: sunday,
|
|
},
|
|
}
|
|
|
|
func getLocaleDateFormat() string {
|
|
s := lookupLocaleSetting(lang.SystemLocale())
|
|
if d := s.dateFormat; d != "" {
|
|
return d
|
|
}
|
|
return defaultDateFormat
|
|
}
|
|
|
|
func getLocaleWeekStart() string {
|
|
s := lookupLocaleSetting(lang.SystemLocale())
|
|
return s.weekStartDay.String()
|
|
}
|
|
|
|
func lookupLocaleSetting(l fyne.Locale) localeSetting {
|
|
region := ""
|
|
lang := l.LanguageString()
|
|
if pos := strings.Index(lang, "-"); pos != -1 {
|
|
region = strings.Split(lang, "-")[1]
|
|
}
|
|
|
|
if setting, ok := localeSettings[region]; ok {
|
|
return setting
|
|
}
|
|
|
|
return localeSettings[""]
|
|
}
|