nsgo-media

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT

README

NSGo Media

English | 简体中文

GitHub Blog X GitHub Sponsors

A video player core for NSGo apps: it decodes with FFmpeg, keeps sound and picture in sync and draws the picture in a view, while the app builds its own controls.

Status

In development: playback, sound, seeking, subtitles and hardware decoding work on macOS, Windows, Linux and iOS for local use. The core installs with go get from v0.1.0. NSGo Player runs from a checkout and installs from the packages nsgo build writes on macOS, Windows and Linux, and the core serves what it needs; the requirements record what the core does and the roadmap orders what comes next.

Usage

An app opens a player, places its view and calls its methods from its own controls:

func Root(cx *core.Scope) core.Node {
	p := player.New(cx)
	p.Open("movie.mkv")
	return core.View{Children: []core.Node{
		player.View{Player: p},
		ui.Button{Text: "Play", OnPress: p.Play},
	}}
}

The player's state, such as p.State(), p.Position() and p.Cues(), is NSGo signals the app's views read. examples/demo is a small player with its own controls, and NSGo Player, in app/, the first-party desktop app: local folders through its built-in plugin, and other sources through plugins with YAML manifests.

The core loads FFmpeg's shared libraries at run time: the ones tools/ffmpeg builds, from the directory NSGO_MEDIA_FFMPEG names, beside the executable or as frameworks in an iOS app, or else the system's FFmpeg 9 (brew install ffmpeg on macOS). nsgo build downloads the desktop ones, published as a release of this repository, into an app's packages and installers; an iOS app gets them with go tool nsgo-media bundle after it. See FFmpeg libraries.

Development

With Go 1.27.3 or later, from the repository root:

go tool nsgo dev examples/demo  # run the demo app with hot reload
go tool nsgo check              # vet every package
go tool nsgo test               # every package's tests
cd app && go tool nsgo dev      # run NSGo Player, a module of its own; check and test it there too

See ARCHITECTURE.md for the design and AGENTS.md for how to work on the project.

License

Licensed under the MIT License. The FFmpeg libraries the project builds are under the LGPL 2.1 or later; FFmpeg libraries lists what an app that ships them owes.

Unless you explicitly state otherwise, any contribution you submit is licensed under the MIT License, without any additional terms or conditions.

Directories

Path Synopsis
cmd
nsgo-media command
Command nsgo-media puts the FFmpeg frameworks NSGo Media loads into an iOS app's Frameworks, which nsgo build wrote, with FFmpeg's license and build note, and signs the app again.
Command nsgo-media puts the FFmpeg frameworks NSGo Media loads into an iOS app's Frameworks, which nsgo build wrote, with FFmpeg's license and build note, and signs the app again.
Package codec provides low-latency video encoding, decoding and hardware capability probing on top of NSGo Media's bundled FFmpeg libraries.
Package codec provides low-latency video encoding, decoding and hardware capability probing on top of NSGo Media's bundled FFmpeg libraries.
examples
demo command
Command demo is a player app with its own controls, showing how an app drives NSGo Media's core: the core draws the picture, the app everything else.
Command demo is a player app with its own controls, showing how an app drives NSGo Media's core: the core draws the picture, the app everything else.
internal
audioout
Package audioout plays interleaved float32 PCM on the system's default output device, with one backend per system: CoreAudio's AudioQueue on macOS and iOS, WASAPI on Windows and PulseAudio (or PipeWire's server for it) on Linux.
Package audioout plays interleaved float32 PCM on the system's default output device, with one backend per system: CoreAudio's AudioQueue on macOS and iOS, WASAPI on Windows and PulseAudio (or PipeWire's server for it) on Linux.
ffmpeg
Package ffmpeg binds the parts of FFmpeg's C API the pipeline uses, through purego, and refuses library versions it does not name.
Package ffmpeg binds the parts of FFmpeg's C API the pipeline uses, through purego, and refuses library versions it does not name.
ffmpeg/library
Package library finds FFmpeg's shared libraries: the directory the NSGO_MEDIA_FFMPEG environment variable names, the app's package, beside the executable, then the system's.
Package library finds FFmpeg's shared libraries: the directory the NSGO_MEDIA_FFMPEG environment variable names, the app's package, beside the executable, then the system's.
pipeline
Package pipeline plays a media source: a demuxer fills bounded packet queues, decoders on their own goroutines turn them into RGBA frames and device audio, and a presenter the engine calls picks the frame the clock has reached.
Package pipeline plays a media source: a demuxer fills bounded packet queues, decoders on their own goroutines turn them into RGBA frames and device audio, and a presenter the engine calls picks the frame the clock has reached.
stats
Package stats counts the use of the demo and NSGo Player in the website's Umami, as pages of the site: the site's own pages are tagged "website", the demo's "demo" and the app's "app".
Package stats counts the use of the demo and NSGo Player in the website's Umami, as pages of the site: the site's own pages are tagged "website", the demo's "demo" and the app's "app".
Package player is NSGo Media's public API: a Player opened on a media source, its commands, its state as NSGo signals, and View, the component that draws its picture.
Package player is NSGo Media's public API: a Player opened on a media source, its commands, its state as NSGo signals, and View, the component that draws its picture.
tools
ffmpeg command
Command ffmpeg builds the FFmpeg shared libraries NSGo Media loads, with LGPL components only, at the pinned version, for each desktop target and as frameworks for iOS, into archives, and FFmpeg's source with its diff into source/, which an app offers beside them.
Command ffmpeg builds the FFmpeg shared libraries NSGo Media loads, with LGPL components only, at the pinned version, for each desktop target and as frameworks for iOS, into archives, and FFmpeg's source with its diff into source/, which an app offers beside them.

Jump to

Keyboard shortcuts

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