Broadcasts - Psy-Virus/ampache GitHub Wiki
Broadcasts
Broadcast what you're currently playing in your web player to other users.
How it works
When you choose to become a broadcaster, all web player events (song change, position, play, pause ...) are transmitted to the web socket server which redistribute the information to listeners. Listeners cannot interact with their web player which is controlled according to what you're doing on your side. This ensures connected listeners are playing the same music at the same time than you.
Prerequisites
- libevent
Apache configuration
Apache doesn't support WebSocket properly, need to setup a proxy.
Enable proxy_wstunnel_module module then add this to your vhost:
ProxyPass /ws ws://127.0.0.1:8100 retry=0
ProxyPassReverse /ws ws://127.0.0.1:8100 retry=0
ProxyRequests off
ProxyTimeout 15
Be aware that wstunnel mod isn't available yet in most distribution as a stable package. You can also temporary open the binding port (8100 here) to internet access and use it directly, but it will not pass most http proxy.
General configuration
See http://socketo.me/docs/deploy#serverconfiguration
Ampache settings
In config/ampache.cfg.php change the following settings:
broadcast = true
websocket_address = "ws://localhost/ws"
Run
php bin/websocket_run.inc -p 8100 > /dev/null &