【问题标题】:PHP(laravel) to create a m3u playlist URL which is playable directly in VLCPHP(laravel) 创建一个 m3u 播放列表 URL,可直接在 VLC 中播放
【发布时间】:2018-10-11 23:34:43
【问题描述】:

我有一个 m3u 播放列表,下载后在 VLC 中打开时可以正常下载和工作。但是我希望有人可以将 URL 粘贴到 VLC,它可以直接工作,而无需先下载文件。我为此使用 laravel,但我不需要。这是下载代码:

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

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

【问题讨论】:

    标签: php vlc playlist m3u


    【解决方案1】:

    我想通了……

    我的初始代码有 2 个错误。

    首先,是 laravel login auth 类不允许 VLC“看到”播放列表。由于我正在执行自己的身份验证,因此我从身份验证中排除了路由并且它运行良好。

    其次,标头数组格式错误。这是正确的代码:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-28
      • 2014-10-31
      • 1970-01-01
      • 2013-05-13
      • 1970-01-01
      • 2017-06-03
      • 2011-02-26
      • 1970-01-01
      相关资源
      最近更新 更多