Skip to content

ryuken/libvlc-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libvlc-go

GoDoc License: MIT

Provides golang bindings for libvlc version 2.X. This is a work in progress and it is not safe for use in a production environment. The current implementation contains only a small portion of libvlc's functionality.

Full documentation can be found at: http://godoc.org/github.com/adrg/libvlc-go

Prerequisites

In order to use this project you need to have libvlc-dev installed. On Debian based distributions it can be installed using apt.

sudo apt-get install libvlc-dev

Installation

go get github.com/adrg/libvlc-go

Usage

package main

import (
	"fmt"
	"time"

	vlc "github.com/adrg/libvlc-go"
)

func main() {
	// Initialize libvlc. Additional command line arguments can be passed in
	// to libvlc by specifying them in the Init function.
	if err := vlc.Init("--no-video", "--quiet"); err != nil {
		fmt.Println(err)
		return
	}
	defer vlc.Release()

	// Create a new player
	player, err := vlc.NewPlayer()
	if err != nil {
		fmt.Println(err)
		return
	}
	defer func() {
		player.Stop()
		player.Release()
	}()

	// Set player media. The second parameter of the method specifies if
	// the media resource is local or remote.
	// err = player.SetMedia("localPath/test.mp4", true)
	err = player.SetMedia("http://stream-uk1.radioparadise.com/mp3-32", false)
	if err != nil {
		fmt.Println(err)
		return
	}

	// Play
	err = player.Play()
	if err != nil {
		fmt.Println(err)
		return
	}

	time.Sleep(30 * time.Second)
}

References

For more information see libvlc.

License

Copyright (c) 2015 Adrian-George Bostan.

This project is licensed under the MIT license. See LICENSE for more details.

About

Golang bindings for libvlc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%