j-holub / MusicServer

Music server to play YouTube songs written in Meteor
MIT License
8 stars 3 forks source link

[Feature] Stream instead of download #1

Open robsdedude opened 8 years ago

robsdedude commented 8 years ago

Enqueuing a webradio or any other stream will break your nice program as you cannot download a continuous stream completely. Try to use something like

youtube-dl --socket-timeout 3 -o - | <player>

Make sure the player is reading from stdin with vlc it would be vlc -.

To pre-buffer songs you could call the command and pause the player right away.

Btw: this would not only fix the issue of a breaking server but would also be a nice feature. It could happen that a user does not want to build a long playlist and therefore want to enqueue a stream.

j-holub commented 8 years ago

Hey thank you for your suggestion.

If you look into the startup.js file the server folder, there is a boolean flag called cached, which if set to false will always use streaming for anything. I was planning to make this flag adjustable by either a config file or a direct button in the players UI.

youtube-dl actually gives back a huge JSON object with a lot of information. When I tried to enqueue two streams I received an entry called "direct", set to true. This might be a way to detect radio streams, but I still have to confirm that.

Another point is how the UI should behave. There is obviously no duration which could be displayed and a slider for the position doesn't make sense either. Without much consideration I'd think of omitting the first and disabling the latter.

But I will definitely look into it, thank you!