0

I'm having an m3u playlist which downloads fine and works when open in VLC after the download. However I want that someone could just paste the URL to VLC and it would work directly without the need to download the file first. I'm using laravel for this but I don't need to. Here is the download code:

$headers = ["Content-Type: audio/x-mpegurl"];

// Trigger the download
return response()->download('/lists/edited.m3u', urlencode($username) . '.m3u', $headers);   
m33ts4k0z
  • 645
  • 7
  • 26

1 Answers1

1

I figured it out...

I had 2 mistakes with my initial code.

First, it was laravels login auth class that wasn't allowing VLC to "see" the playlist. Since I'm performing my own authentication, I excluded the route from auth and it worked fine.

Secondly, the header array was malformed. Here is the correct code:

$headers = [
    'Content-Type' => 'audio/x-mpegurl',
 ];
// Trigger the download

return response()->download('/lists/edited.m3u', urlencode($username) . '.m3u',$headers);

m33ts4k0z
  • 645
  • 7
  • 26