vicwomg / pikaraoke

Youtube-based Karaoke machine for Raspberry Pi, OSX, Windows, and Linux
GNU General Public License v3.0
461 stars 117 forks source link

Adding an ffmpeg url parameter #301

Closed nathanpalmer closed 4 months ago

nathanpalmer commented 6 months ago

This adds a way to override the ffmpeg_url. Specifically helpful in proxy situations where the website domain and the ffmpeg domain aren't going to be the same. It should fallback to the same URL it is using today if you don't pass in the parameter though.

Allows me to do this:

python3 app.py --url karaoke.example.com --ffmpeg-url karaoke-stream.example.com

The issue comes down to this. I don't want people who are coming to my house for the karaoke party to have to connect to my wifi network in order to use that QR code. I'd like to reduce as much friction as possible. So I have my existing network proxying the main URL going to the backend. However, we can't use that main URL as the ffmpeg_url because the PORT doesn't proxy through my router. (yes, I can setup a port forward.. but I had this dynamically assigning ports when using nomad so this option works a bit better.)

vicwomg commented 6 months ago

Good timing, we're discussing this in #293 which is an effort to dockerize everything. The same issue was encountered.

Can you explain a little more how you have things setup on your proxy?

vicwomg commented 6 months ago

On second thought, can you try this branch and see if it suits your needs?

303-proxy_http_ffmpeg_streams

This will have pikaraoke do all the proxying to ffmpeg, so it will all run on one port.

nathanpalmer commented 6 months ago

Can you explain a little more how you have things setup on your proxy?

Sure. My router (Arista) is forwarding port 80/443 to a service router (Fabio) that handles the HTTPS termination and routes traffic to the right IP and port that it's running on. Since by default it uses the same url for ffmpeg and just appends the port, that doesn't make it through my router.

However, the other branch.. if it's all working on the same port sounds like it should also solve this issue. So I can try it.

vicwomg commented 6 months ago

Can you explain a little more how you have things setup on your proxy?

Sure. My router (Arista) is forwarding port 80/443 to a service router (Fabio) that handles the HTTPS termination and routes traffic to the right IP and port that it's running on. Since by default it uses the same url for ffmpeg and just appends the port, that doesn't make it through my router.

However, the other branch.. if it's all working on the same port sounds like it should also solve this issue. So I can try it.

Yes please try the other branch and let me know. I believe that would be a cleaner solution overall

nathanpalmer commented 4 months ago

Yes please try the other branch and let me know. I believe that would be a cleaner solution overall

Sorry for the delay! We had a new years eve party and I didn't want to change anything right before that. But finally got a chance to try it out.

I opened up the other branch and it seems to work just fine as well. So either way that you want to go seems to be OK. I see the other branch is still open though. But either way will solve my problem.

I see there are some conflicts here, so if you want to go this direction I can resolve them. Otherwise, if you're going to merge the other branch in, we can close.