player

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2026 License: EUPL-1.2 Imports: 9 Imported by: 0

Documentation

Overview

Package player provides the core media player functionality for dapp.fm It can be used both as Wails bindings (memory speed) or HTTP server (fallback)

Index

Constants

This section is empty.

Variables

View Source
var Assets fs.FS

Assets returns the embedded filesystem with frontend/ prefix stripped

Functions

func GetDemoTrack

func GetDemoTrack() ([]byte, error)

GetDemoTrack returns the embedded demo track content

func GetIndex

func GetIndex() ([]byte, error)

GetIndex returns the main HTML page

Types

type AttachmentInfo

type AttachmentInfo struct {
	Name     string `json:"name"`
	MimeType string `json:"mime_type"`
	Size     int    `json:"size"`
	DataURL  string `json:"data_url"` // Base64 data URL for direct playback
}

AttachmentInfo describes a decrypted attachment

type DecryptResult

type DecryptResult struct {
	Body        string           `json:"body"`
	Subject     string           `json:"subject,omitempty"`
	From        string           `json:"from,omitempty"`
	Attachments []AttachmentInfo `json:"attachments,omitempty"`
}

DecryptResult holds the decrypted message data

type ManifestInfo

type ManifestInfo struct {
	Title         string      `json:"title,omitempty"`
	Artist        string      `json:"artist,omitempty"`
	Album         string      `json:"album,omitempty"`
	Genre         string      `json:"genre,omitempty"`
	Year          int         `json:"year,omitempty"`
	ReleaseType   string      `json:"release_type,omitempty"`
	Duration      int         `json:"duration,omitempty"`
	Format        string      `json:"format,omitempty"`
	ExpiresAt     int64       `json:"expires_at,omitempty"`
	IssuedAt      int64       `json:"issued_at,omitempty"`
	LicenseType   string      `json:"license_type,omitempty"`
	Tracks        []TrackInfo `json:"tracks,omitempty"`
	IsExpired     bool        `json:"is_expired"`
	TimeRemaining string      `json:"time_remaining,omitempty"`
}

ManifestInfo holds public metadata (readable without decryption)

type Player

type Player struct {
	// contains filtered or unexported fields
}

Player provides media decryption and playback services Methods are exposed to JavaScript via Wails bindings

func NewPlayer

func NewPlayer() *Player

NewPlayer creates a new Player instance

func (*Player) Decrypt

func (p *Player) Decrypt(encrypted string, password string) (*DecryptResult, error)

Decrypt decrypts the SMSG content and returns playable media This is memory-speed via Wails bindings - no HTTP, no WASM

func (*Player) GetLicenseInfo

func (p *Player) GetLicenseInfo(encrypted string) (map[string]interface{}, error)

GetLicenseInfo returns detailed license information

func (*Player) GetManifest

func (p *Player) GetManifest(encrypted string) (*ManifestInfo, error)

GetManifest returns public metadata without decryption This is memory-speed via Wails bindings

func (*Player) IsLicenseValid

func (p *Player) IsLicenseValid(encrypted string) (bool, error)

IsLicenseValid checks if the license has expired This is memory-speed via Wails bindings

func (*Player) QuickDecrypt

func (p *Player) QuickDecrypt(encrypted string, password string) (string, error)

QuickDecrypt returns just the first attachment as a data URL Optimized for single-track playback

func (*Player) Serve

func (p *Player) Serve(addr string) error

Serve starts an HTTP server for CLI/fallback mode This is the slower TCP path - use Wails bindings when possible

func (*Player) Startup

func (p *Player) Startup(ctx context.Context)

Startup is called when the Wails app starts

type TrackInfo

type TrackInfo struct {
	Title    string  `json:"title"`
	Start    float64 `json:"start"`
	End      float64 `json:"end,omitempty"`
	Type     string  `json:"type,omitempty"`
	TrackNum int     `json:"track_num,omitempty"`
}

TrackInfo describes a track marker

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL