From 4cd53247a66215ad7696b9bcab8571abccbe28c0 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 22 Oct 2023 23:42:25 -0600 Subject: [PATCH] Add MediaHlsService --- app/Services/Media/MediaHlsService.php | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 app/Services/Media/MediaHlsService.php diff --git a/app/Services/Media/MediaHlsService.php b/app/Services/Media/MediaHlsService.php new file mode 100644 index 00000000..04b5ac64 --- /dev/null +++ b/app/Services/Media/MediaHlsService.php @@ -0,0 +1,27 @@ +media_path; + if(!$path) { return; } + $parts = explode('/', $path); + $filename = array_pop($parts); + $dir = implode('/', $parts); + [$name, $ext] = explode('.', $filename); + + $files = Storage::files($dir); + + return collect($files) + ->filter(function($p) use($dir, $name) { + return str_starts_with($p, $dir . '/' . $name); + }) + ->values() + ->toArray(); + } +}