mplayer

package module
v0.0.0-...-e2f6471 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: MIT Imports: 9 Imported by: 1

README

mplayer

A library to allow playing media files (remote and local) from your gocode

Install

go get github.com/bisoncorps/mplayer

What is mplayer

mplayer is just a means to allow for playing media files from golang. It allows for streaming online media files and local media files as well. It hopes to incorporate functionalities that support using any known media player. Currently only browser is supported but other players are currently being considered. It supports

  • In Browser Playing, MPV and VLC
  • playing local files
  • streaming online resource

Usage

package main

import  (
  "log"
  "github.com/bisoncorps/mplayer"
)

func main() {
		p, err := mplayer.GetPlayer("browser")
		if err != nil {
			log.Fatal(err)
		}
    // urls can be remote too
		p.SetURL("/home/manasseh/Videos/Jumanji.mp4")
		p.SetTitle("Jumanji MP4")
		p.Play()
}

TODO

  • Add other players (mpv, vlc)
  • Add subtitle options

Documentation

Overview

Package player : supports playing videos via different players: Web (HTML), MPV and later other video players

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPlayers

func GetPlayers() map[string]Player

GetPlayers : A map of all available players

Types

type BrowserPlayer

type BrowserPlayer struct {
	Props
}

BrowserPlayer : Plays a movie in a HTML web page

func (*BrowserPlayer) Play

func (p *BrowserPlayer) Play()

Play : Opens browser and play media

type MPVPlayer

type MPVPlayer struct {
	Props
}

MPVPlayer : Plays a movie in a HTML web page

func (*MPVPlayer) Play

func (p *MPVPlayer) Play()

Play : Opens browser and play media

type Player

type Player interface {
	Play()
	SetTitle(string)
	SetURL(string)
}

Player : interface functions for every Player

func GetPlayer

func GetPlayer(player string) (Player, error)

GetPlayer : get a player for streaming

type Props

type Props struct {
	URL   string
	Title string
}

Props : Props to be passed to Player

func (*Props) SetTitle

func (p *Props) SetTitle(title string)

func (*Props) SetURL

func (p *Props) SetURL(URL string)

type VLCPlayer

type VLCPlayer struct {
	Props
}

VLCPlayer : Plays a movie in a HTML web page

func (*VLCPlayer) Play

func (p *VLCPlayer) Play()

Play : Opens browser and play media

Jump to

Keyboard shortcuts

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