Skip to content

About

A video player core for NSGo apps in Go: FFmpeg decoding, audio-video sync, subtitles and hardware decoding, with the picture drawn in a view and every control left to the app — macOS, Windows, Linux and iOS

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

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, with no published release. 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.

About

A video player core for NSGo apps in Go: FFmpeg decoding, audio-video sync, subtitles and hardware decoding, with the picture drawn in a view and every control left to the app — macOS, Windows, Linux and iOS

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages