1
0
Fork 0
forked from mirror/pixelfed

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

View file

@ -4,6 +4,7 @@ namespace App\Transformer\Api;
use App\Media;
use League\Fractal;
use Storage;
class MediaTransformer extends Fractal\TransformerAbstract
{
@ -28,6 +29,10 @@ class MediaTransformer extends Fractal\TransformerAbstract
'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) {
$res['meta'] = [
'focus' => [