Update MediaTransformer, add hls_manifest attribute

This commit is contained in:
Daniel Supernault 2023-10-23 00:38:37 -06:00
parent 4e3e23db36
commit fac7c3c5e7
No known key found for this signature in database
GPG Key ID: 23740873EE6F76A1
1 changed files with 5 additions and 0 deletions

View File

@ -4,6 +4,7 @@ namespace App\Transformer\Api;
use App\Media; use App\Media;
use League\Fractal; use League\Fractal;
use Storage;
class MediaTransformer extends Fractal\TransformerAbstract class MediaTransformer extends Fractal\TransformerAbstract
{ {
@ -28,6 +29,10 @@ class MediaTransformer extends Fractal\TransformerAbstract
'blurhash' => $media->blurhash ?? 'U4Rfzst8?bt7ogayj[j[~pfQ9Goe%Mj[WBay' 'blurhash' => $media->blurhash ?? 'U4Rfzst8?bt7ogayj[j[~pfQ9Goe%Mj[WBay'
]; ];
if(config('media.hls.enabled') && $media->hls_transcoded_at != null && $media->hls_path) {
$res['hls_manifest'] = url(Storage::url($media->hls_path));
}
if($media->width && $media->height) { if($media->width && $media->height) {
$res['meta'] = [ $res['meta'] = [
'focus' => [ 'focus' => [