media

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProtocolName

func ProtocolName(p Protocol) string

ProtocolName returns a human-readable name for the protocol.

Types

type Cache

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

Cache is an LRU cache for rendered media (terminal strings).

func NewCache

func NewCache(maxSize int) *Cache

NewCache creates a new media cache.

func (*Cache) Clear

func (c *Cache) Clear()

Clear empties the cache.

func (*Cache) Get

func (c *Cache) Get(key string) (string, bool)

Get returns a cached rendered image, if available.

func (*Cache) Set

func (c *Cache) Set(key, value string)

Set stores a rendered image in the cache.

type ImageRenderer

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

func NewImageRenderer

func NewImageRenderer(protocol Protocol, maxWidth, maxHeight int) *ImageRenderer

func (*ImageRenderer) RenderFile

func (r *ImageRenderer) RenderFile(path string) (string, error)

func (*ImageRenderer) RenderImage

func (r *ImageRenderer) RenderImage(img image.Image) (string, error)

type PlaybackState

type PlaybackState int

PlaybackState represents the state of audio/video playback.

const (
	PlaybackStopped PlaybackState = iota
	PlaybackPlaying
	PlaybackPaused
)

type Protocol

type Protocol int

Protocol represents a terminal image rendering protocol.

const (
	ProtocolBlocks Protocol = iota // Unicode half-block fallback
	ProtocolSixel                  // Sixel graphics
	ProtocolKitty                  // Kitty graphics protocol
)

func DetectProtocol

func DetectProtocol() Protocol

DetectProtocol probes the terminal for image rendering capabilities.

func ResolveProtocol

func ResolveProtocol(configValue string) Protocol

ResolveProtocol returns the protocol to use based on config and detection.

type VideoPlayer

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

VideoPlayer launches videos in an external player.

func NewVideoPlayer

func NewVideoPlayer(player string) *VideoPlayer

NewVideoPlayer creates a new video player launcher.

func (*VideoPlayer) Play

func (v *VideoPlayer) Play(filePath string) error

Play launches a video file in the external player.

type VoicePlayer

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

VoicePlayer handles voice message playback.

func NewVoicePlayer

func NewVoicePlayer(player string) *VoicePlayer

NewVoicePlayer creates a new voice player using the specified player binary.

func (*VoicePlayer) IsPlaying

func (v *VoicePlayer) IsPlaying() bool

IsPlaying returns true if audio is currently playing.

func (*VoicePlayer) Play

func (v *VoicePlayer) Play(filePath string) error

Play starts playing a voice note file.

func (*VoicePlayer) State

func (v *VoicePlayer) State() PlaybackState

State returns the current playback state.

func (*VoicePlayer) Stop

func (v *VoicePlayer) Stop()

Stop stops the current playback.

Jump to

Keyboard shortcuts

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