Skip to content

xaionaro-go/player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

player

License: CC0-1.0

This is a package that allows to play media files/stream in Go. See demo in ./cmd/player.

A minimal example to play a media file/stream would be:

    m := player.NewManager(types.OptionPathToMPV(*mpvPath))
    p, err := m.NewPlayer(ctx, "player demonstration", player.BackendLibAVFyne) // available values: player.BackendLibVLC, player.BackendMPV, player.BackendLibAVFyne and others
    if err != nil {
        return fmt.Errorf("unable to open a media player: %w", err)
    }

    err = p.OpenURL(ctx, mediaPath)
    if err != nil {
        return fmt.Errorf("unable to open the url '%s': %v", mediaPath, err)
    }
  • To have the support of BackendLibVLC one must build with tag with_libvlc.
  • To have the support of BackendLibAVFyne one must build with tags with_libav,with_fyne.

An example how to run the demo:

go run -tags with_libvlc ./cmd/player/ --backend libvlc MY_MEDIA_FILE_HERE

Or:

go run -tags with_libav,with_fyne ./cmd/player/ --backend libav_fyne MY_MEDIA_FILE_HERE

Expected result: demo screenshot

Installing dependencies

Ubuntu

# fyne
sudo apt install -y libgl-dev libx11-dev libxrandr-dev libxcursor-dev libxinerama-dev libxi-dev libxxf86vm-dev

# audio
sudo apt install -y libasound2-dev

# libav
sudo apt install -y libavcodec-dev libavdevice-dev

# libvlc
sudo apt install -y libvlc-dev

# mpv
sudo apt install -y mpv

Fedora

# fyne
sudo dnf install -y libglvnd-devel libX11-devel libXrandr-devel libXcursor-devel libXinerama-devel libXi-devel libXxf86vm-devel

# audio
sudo dnf install -y alsa-lib-devel

# libav
sudo dnf install -y libavcodec-free-devel libavdevice-free-devel libavfilter-free-devel libavformat-free-devel libavutil-free-devel

# libvlc
sudo dnf install -y vlc-devel

# mpv
sudo dnf install -y mpv

About

A media (audio/video) player for Go. Few choices of the backend: libvlc, mpv, libav

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors