Skip to content

zivkovicmilos/go-vlc

Repository files navigation

Overview

go-vlc is a Go library for interacting with running VLC instances over the VLC HTTP API. This library acts as a client implementation, offering seamless integration with officially documented VLC API endpoints.

The library encompasses a range of endpoints, as outlined in the sections below:

Installation

Integrating go-vlc into your project is straightforward, execute the following command:

go get -u github.com/zivkovicmilos/go-vlc

This command ensures that you have the latest version of go-vlc in your project.

Running the VLC HTTP server

To run the VLC HTTP server, using the CLI interface, execute the following command:

vlc --extraintf http --http-port 8080 --http-password 1234

Remember, the password used here is crucial for initializing and authenticating the VLC client within the go-vlc library.

For GUI-based server initialization, please consult the official VLC documentation.

Example usage

Below is a sample Go program demonstrating how to utilize the go-vlc library:

package main

import (
	"fmt"

	"github.com/zivkovicmilos/go-vlc/client/http"
	"github.com/zivkovicmilos/go-vlc"
)

func main() {
	// Create the VLC credentials
	baseURL := "http://127.0.0.1:8080" // server IP, and the http-port value

	auth := http.RequestAuth{
		Username: "",     // the username; default empty
		Password: "1234", // the http-password value
	}

	// Create the VLC client
	client := http.NewClient(baseURL, auth)

	// Create the VLC instance
	v := vlc.NewVLC(client)

	// Call any VLC method
	status, err := v.GetStatus()
	if err != nil {
		panic(err)
	}

	fmt.Printf("%+v\n", status)
}

About

A Go client implementation for the VLC HTTP server

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published