Playing video download from get
mohdfayeem opened this issue · 1 comments
mohdfayeem commented
I've uploaded a video into my Google drive. Then is fetch the same video by the get route as mentioned below:
Route::get('get', function() {
$filename = 'test.txt';
$dir = '/';
$recursive = false; // Get subdirectories also?
$contents = collect(Storage::cloud()->listContents($dir, $recursive));
$file = $contents
->where('type', '=', 'file')
->where('filename', '=', pathinfo($filename, PATHINFO_FILENAME))
->where('extension', '=', pathinfo($filename, PATHINFO_EXTENSION))
->first(); // there can be duplicate file names!
//return $file; // array with file info
$rawData = Storage::cloud()->get($file['path']);
return response($rawData, 200)
->header('ContentType', $file['mimetype'])
->header('Content-Disposition', "attachment; filename='$filename'");
});
I'm getting the video in base format or simply the raw data. I just want to know that how can I play this raw data to my web page.
The file is restricted to the root user and I don't want to play directly using the Google drive link.
Or is there a better way to do it.
Thank you.
parallels999 commented
This package is abandoned since 2020, don't wait any answer