Skip to content

🎵 a simple library that makes it easy to implement a plug.dj clone

License

Notifications You must be signed in to change notification settings

SoMuchForSubtlety/opendj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc Go Report Card

opendj

a simple library that makes it easy to implement a plug.dj clone

This library needs ffmpeg and youtube-dl to work!
It should be able to stream anything you can use the following command on

$ youtube-dl -f bestaudio -g {url}

example usage

package main

import (
	"fmt"
	"github.com/SoMuchForSubtlety/opendj"
)

func main() {
	var dj opendj.Dj
	// add a handler that gets called when a new song plays
	dj.AddNewSongHandler(newSong)

	// create a QueueEntry
	// please don't actually do this manually
	var song opendj.Media
	song.Title = "BADBADNOTGOOD - CAN'T LEAVE THE NIGHT"
	song.URL = "https://www.youtube.com/watch?v=caY0MEok19I"
	song.Duration = 282000000000

	var entry opendj.QueueEntry
	entry.Media = song
	entry.Owner = "MyUsername"

	// add the entry to the queue
	dj.AddEntry(entry)

	// start playing to your favourite RTMP server
	dj.Play("http://example.org/rtmp/23rhwogvf984hgtw")
}

func newSong(entry opendj.QueueEntry) {
	fmt.Printf("now playing %s", entry.Media.Title)
}

About

🎵 a simple library that makes it easy to implement a plug.dj clone

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages