如何从laravel存储播放m3u8视频

时间:2019-03-10 05:49:11

标签: php laravel ffmpeg video-streaming

我使用ffmpeg将MP4视频转换为M3U8格式,以具有多种品质并流式传输我的视频。出于安全原因,我必须将视频放在存储文件夹中(而不是公共文件夹),现在当我尝试观看视频时,浏览器只会下载M3U8文本文件,而视频则不会显示。我安装了chrome扩展程序以显示M3U8视频,如果将文件放在公用文件夹中并直接调用URL,则可以看到M3U8视频。这是我的代码

$fileName = $product->details()['sample_file_name'];
$filePath = $product->type.'s/'.$product->id.'/'.$fileName;       
$fileContents = Storage::disk('products')->path($filePath);
$header = ['Content-type' => Storage::disk('products')->mimeType($filePath)];
$header = ['Content-Disposition' => 'attachment; filename='.basename($filePath)];
$response = Response::download($fileContents, $fileName, $header);
return $response;

请帮助我为下载响应设置哪些标题。

0 个答案:

没有答案
相关问题