Replaces the busy-wait polling loop in `waitForWasm` with a `borgstmf:ready` event listener. This eliminates unnecessary CPU usage during initialization and potentially improves latency. Also updates the `stmf.wasm` binary to ensure it contains the event dispatch logic present in `pkg/wasm/stmf/main.go`. Fixes a CI build failure by changing `pkg/player/assets.go` to use directory embedding (`//go:embed frontend`) instead of explicit file embedding, which avoids errors when ignored files (like `demo-track.smsg`) are missing in the CI environment.
33 lines
715 B
Go
33 lines
715 B
Go
package player
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
)
|
|
|
|
// Assets embeds all frontend files for the media player
|
|
// These are served both by Wails (memory) and HTTP (fallback)
|
|
//
|
|
//go:embed frontend
|
|
var assets embed.FS
|
|
|
|
// Assets returns the embedded filesystem with frontend/ prefix stripped
|
|
var Assets fs.FS
|
|
|
|
func init() {
|
|
var err error
|
|
Assets, err = fs.Sub(assets, "frontend")
|
|
if err != nil {
|
|
panic("failed to create sub filesystem: " + err.Error())
|
|
}
|
|
}
|
|
|
|
// GetDemoTrack returns the embedded demo track content
|
|
func GetDemoTrack() ([]byte, error) {
|
|
return fs.ReadFile(Assets, "demo-track.smsg")
|
|
}
|
|
|
|
// GetIndex returns the main HTML page
|
|
func GetIndex() ([]byte, error) {
|
|
return fs.ReadFile(Assets, "index.html")
|
|
}
|