# README
StreamDude
A work in progress simple playlist manager to remotely send files to a streaming server.
Licensed under a MIT License.
Purpose
There are a million gorgeous tools out there which allow you to manage your local playlist and send it to a streaming server; there are million more — such as OBS — which, while not stricly designed to do just that, can very easily be adapted for that purpose. And there are a billion that even allow you to stream (using so-called progressive download) files from a webpage to your friends?
But what if your music is not stored locally, or you wish to avoid the inevitable delays (latency and/or jitter) for sending the files from your computer to a remote server, and stream from there? Think of an Internet radio station, managed by several parties, with a common repository of music (or video!), all stored and managed remotely. Oh, of course: and for free.
Well, you're out of luck.
The oldest tool I know that does just that is Apple's own Darwin Streaming Server — which is even free and open-source — but it's overkill if you already have an external streaming server that you connect with.
There are a few complex ones out there, some even for free, but installing them is a pain.
Thus, StreamDude.
No, really?
Well, no, I'm lying.
Actually what I really need right now is a simple way to get scripts from inside the Second Life® and OpenSimulator to be able to remotely select what streams to play. I could do it with a single Python command line argument (no need to run or compile anything or write any code whatsoever). But what would be the fun in that?
Instead, I'm sort of joining three separate projects into one.
Environment variables
LAL_MASTER_KEY
- because it's too dangerous to keep it in code and/or filesSTREAMER_URL
- another way to override the streamer URL; may be useful in scripts
Also, StreamDude attempts to comply with the informal CLICOLOR_FORCE
and NO_COLOR
conventions. See https://bixense.com/clicolors/ and https://no-color.org/.
Compile & launch
You can get here the full API for Postman.
Currently, the only streaming server supported is lal (Live And Live).
- Make sure you have the streaming server running first!
go install github.com/GwynethLLewelyn/StreamDude@latest
or, if you prefer,git clone https://github.com/GwynethLLewelyn/StreamDude
.- If you cloned the repo, then run
go build
(and possibly withgo install
you'll get the compiled binary under~/go/bin
, which, hopefully, is part of your$PATH
) LAL_MASTER_KEY=blahblehblih ./StreamDude -d
(if you wish debugging to console, or redirect it to a log file)/usr/bin/curl --header "Content-Type: application/json" --header "Accept: application/json" --request GET http://127.0.0.1:3554/ping
— should give{"message":"pong back to 127.0.0.1","status":"ok"}
/usr/bin/curl --header "Content-Type: application/json" --header "Accept: application/json" --request POST --data '{ "objectPIN": "0000" }' http://127.0.0.1:3554/api/auth
— should give you an authentication token, e.g.ZmFrZXRva2Vu
/usr/bin/curl --header "Content-Type: application/json" --header "Accept: application/json" --request POST --data '{ "token": "ZmFrZXRva2Vu", "filename": "/path/to/video.mp4" }' http://127.0.0.1:3554/api/play
— should launch ffmpeg and sendvideo.mp4
to be streamed
Note: objectPIN
and token
are not really, really being enforced — there is no database/KV store backend yet, but as soon as there is one, I've put the validation code in place, so you should fill in those fields.
Also note that there are further fields for Second Life®/OpenSimulator, all of which are being ignored right now.
Backoffice
Currently not implemented. There is just a home page and a Ping test. The remaining menu areas are not really working (they will become forms for testing purposes).
The home page, properly speaking, will become an instance of MusicFolderPlayer (the inspiration for this project).
Nginx conf sample
Assumptions
- You're running Unix-like environment (WSL2 will possibly work, too);
nginx
is pointing tohttp(s)://my.streaming.server
under/var/www/my.streaming.server
;- StreamDude is installed under
/StreamDude
(i.e./templates
and/assets
are there) - It runs as a service under
localhost:3445
(default)
Then you will need something like this:
location ~* /StreamDude/assets {
rewrite ^/StreamDude/assets/(.*)$ /$1 break;
root /var/www/my.streaming.server/StreamDude/assets;
expires max;
add_header Cache-Control public;
fastcgi_hide_header Set-Cookie;
try_files $uri =404;
}
location ~* /StreamDude/templates {
rewrite ^/StreamDude/templates/(.*)$ /$1 break;
root /var/www/my.streaming.server/StreamDude/templates;
expires max;
add_header Cache-Control public;
fastcgi_hide_header Set-Cookie;
try_files $uri =404;
}
location /StreamDude/ {
proxy_pass_request_headers on;
proxy_pass_request_body on;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass_header CF-Connecting-IP;
proxy_pass_header CF-IPCountry;
proxy_pass_header Set-Cookie;
proxy_buffering off;
proxy_ssl_server_name on;
proxy_read_timeout 5m;
proxy_set_header Access-Control-Allow-Credentials true;
proxy_set_header Content-Encoding gzip;
proxy_pass http://127.0.0.1:3554;
}
location ~* ^.+\.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|lsl|lua)$ {
access_log off; log_not_found off; expires max;
add_header Cache-Control public;
fastcgi_hide_header Set-Cookie;
}
and launch StreamDude (in debug mode) with:
$ ./StreamDude -d -r rtsp://127.0.0.1:5544/ -u /StreamDude -x my.streaming.server
Add -P ":443"
if your front-end server is running HTTPS.
If you're launching StreamDude directly from the root of your virtual host (i.e. no /StreamDude
subfolder), then you might need to add a trailing slash on proxy_pass http://127.0.0.1:3554/;
. Getting the slashes to match properly is always messy.
Launching from systemd
If you're running a Unix version supporting systemd
, you can grab a sample unit service file to adapt to your needs. StreamDude complies with the sd_notify
specifications and tries to play nicely with systemd
.
Coloured journald
logs are yet to be implemented, but at least you can get them using journalctl -u StreamDude -f
.
Release notes
See CHANGELOG.md.