Remote audio player (on Raspberry Pi)?
async/await, Fetch API, ES6 syntax are used in this application.
So please use the latest version web browser.
I am checking the operation with the latest version of chrome and firefox.
Writing each environment variable to .env, it is reflected.
| Parameter | Default | Example | Description |
|---|---|---|---|
| JUKEBOX_NO_WEB_UI | '' | 'yes' | If you set the value, startup with no web UI. |
| JUKEBOX_PORT | 8888 | 3000 | If you set the value, startup with the port of the set value. |
| JUKEBOX_CACHE_TIME | 60000 | 0 | Request cache time (mill seconds). |
| JUKEBOX_SPEAKER_BUFFER_TIME | 50 | 1000 | Time to send data for internal buffering of speaker before music playback. This value relates to the response time of music stop and volume change. If noise is heard, increase this value. |
| JUKEBOX_FORCE_MUTE | '' | 'yes' | If you set yes, true or 1 to the value, the speaker don't sound (even if the volume is changed). |
| Parameter | Default | Example | Description |
|---|---|---|---|
| DEBUG | 'jukebox:server:*' | 'jukebox:*,-jukebox:speaker:stream:*' | Debugging namespaces. See debug. Supported namespaces can be confirmed by executing find src -name \*.js -exec cat {} \; | grep -E "(require\('debug'\)\()|(Debug\()" | sed -E "s/.*\('(.*)'\).*/\1/" |
| Parameter | Default | Example | Description |
|---|---|---|---|
| E2E_WAIT_TIME | 5000 | 1000 | The number of milliseconds to wait to check behavior with our eyes and ears. This can be set as a small value in local tests, but care that a too small value causes bugs. |
| E2E_PRESENT_WAIT_TIME | 30000 | 60000 | The maximum number of milliseconds to wait presentation. Please increase this value when the network speed is slow. |
This project uses yarn for package management and task runner.
On Debian/Ubuntu:
$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ sudo apt-get update && sudo apt-get install yarnfor speaker package
speaker package requires alsa.h header file.
On Debian/Ubuntu:
$ sudo apt-get install libasound2-devfor fluent-ffmpeg package
fluent-ffmpeg package requires ffmpeg command.
On Debian/Ubuntu:
$ sudo apt-get install ffmpegFirst, comment in <script src="https://unpkg.com/vue/dist/vue.min.js"></script> in assets/index.html.
Next, comment out <script src="https://unpkg.com/vue"></script> in the same file.
$ export NODE_ENV=production
$ yarn install
$ yarn startLet's access to http://localhost:8888
$ yarn install
$ yarn run dev // start nodemonLet's access to http://localhost:8888
Support for other providers will come later.
- Fork it
- Create a branch (
git checkout -b my-fix) - Commit your changes (
git commit -am "fix something") - Push to the branch (
git push origin my-fix) - Open a Pull Request
- Have a coffee break and wait
POST /player/start
$ curl -X POST http://localhost:8888/player/startPOST /player/stop
$ curl -X POST http://localhost:8888/player/stopPOST /player/next
$ curl -X POST http://localhost:8888/player/nextPOST /player/prev
$ curl -X POST http://localhost:8888/player/prevPOST /player/loop/one/on
$ curl -X POST http://localhost:8888/player/loop/one/onPOST /player/loop/one/off
$ curl -X POST http://localhost:8888/player/loop/one/offPOST /player/loop/playlist/on
$ curl -X POST http://localhost:8888/player/loop/playlist/onPOST /player/loop/playlist/off
$ curl -X POST http://localhost:8888/player/loop/playlist/offGET /player/status
An object of information of the player status and the playlist links.
{
"one_loop": false,
"playlist_loop": false,
"now_playing": false,
"now_playing_idx": 0,
"now_playing_content": null,
"playlist": [
{
"provider": "youtube",
"link": "https://youtu.be/1m53lVsc2As",
"length_seconds": "275",
"id": "1m53lVsc2As",
"title": "\"Beautiful Flight\" / performed by H ZETTRIO 【Official MV】",
"thumbnail_link": "http://i.ytimg.com/vi/1m53lVsc2As/maxresdefault.jpg"
},
{
"provider": "youtube",
"link": "https://www.youtube.com/watch?v=gjDrEdEzfQc",
"length_seconds": "330",
"id": "gjDrEdEzfQc",
"title": "bohemianvoodoo \"Adria Blue\" 【Music Video】",
"thumbnail_link": "http://i.ytimg.com/vi/gjDrEdEzfQc/maxresdefault.jpg"
}
]
}$ curl -X GET http://localhost:8888/player/statusPOST /playlist
An array of audio links that you want to add to the playlist.
[
"https://youtu.be/id1",
"https://youtu.be/id2",
"https://youtu.be/id3"
]An array of unavailable links and error messages.
[
{
"link": "https://youtu.be/id1",
"err_msg": "This link belongs to an unsupported provider"
},
{
"link": "https://youtu.be/id2",
"err_msg": "This 'provider name' link can not be played at the moment"
}
]$ curl -H "content-type:application/json" -X POST -d '["https://youtu.be/1m53lVsc2As","https://www.youtube.com/watch?v=gjDrEdEzfQc"]' http://localhost:8888/playlist
DELETE /playlist
$ curl -X DELETE http://localhost:8888/playlistA response of /player/status is delivered when some event(e.g. audio play started) occurs.
GET /socket
