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
68 lines
1.4 KiB
Go
68 lines
1.4 KiB
Go
//go:build !wasm
|
|
|
|
package app
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
func (p *preferences) storageWriter() (writeSyncCloser, error) {
|
|
return p.storageWriterForPath(p.storagePath())
|
|
}
|
|
|
|
func (p *preferences) storageReader() (io.ReadCloser, error) {
|
|
return p.storageReaderForPath(p.storagePath())
|
|
}
|
|
|
|
func (p *preferences) storageWriterForPath(path string) (writeSyncCloser, error) {
|
|
err := os.MkdirAll(filepath.Dir(path), 0o700)
|
|
if err != nil { // this is not an exists error according to docs
|
|
return nil, err
|
|
}
|
|
file, err := os.Create(path)
|
|
if err != nil {
|
|
if !os.IsExist(err) {
|
|
return nil, err
|
|
}
|
|
file, err = os.Open(path) // #nosec
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return file, nil
|
|
}
|
|
|
|
func (p *preferences) storageReaderForPath(path string) (io.ReadCloser, error) {
|
|
file, err := os.Open(path) // #nosec
|
|
if err != nil {
|
|
if os.IsNotExist(err) {
|
|
if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, errEmptyPreferencesStore
|
|
}
|
|
return nil, err
|
|
}
|
|
return file, nil
|
|
}
|
|
|
|
// the following are only used in tests to save preferences to a tmp file
|
|
|
|
func (p *preferences) saveToFile(path string) error {
|
|
file, err := p.storageWriterForPath(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return p.saveToStorage(file)
|
|
}
|
|
|
|
func (p *preferences) loadFromFile(path string) error {
|
|
file, err := p.storageReaderForPath(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return p.loadFromStorage(file)
|
|
}
|