From 52976f416d9170ce76846eaba67d3b09563533c9 Mon Sep 17 00:00:00 2001 From: buttle Date: Fri, 9 Apr 2021 18:25:28 +0200 Subject: [PATCH] adds peertube api request --- src/Media/Ingester/PeertubeMediaIngester.php | 4 +++- src/Media/Renderer/PeertubeMediaRenderer.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Media/Ingester/PeertubeMediaIngester.php b/src/Media/Ingester/PeertubeMediaIngester.php index cc2838e..0bee3df 100644 --- a/src/Media/Ingester/PeertubeMediaIngester.php +++ b/src/Media/Ingester/PeertubeMediaIngester.php @@ -64,6 +64,8 @@ class PeertubeMediaIngester implements IngesterInterface } // Set the Media source and data. $media->setSource($url); - $media->setData(json_decode($response->getBody(), true)); + $media_data = json_decode($response->getBody()); + $media_data->embedPath = $base_url . $media_data->embedPath; + $media->setData($media_data, true); } } diff --git a/src/Media/Renderer/PeertubeMediaRenderer.php b/src/Media/Renderer/PeertubeMediaRenderer.php index 6b788b8..d24eed7 100644 --- a/src/Media/Renderer/PeertubeMediaRenderer.php +++ b/src/Media/Renderer/PeertubeMediaRenderer.php @@ -11,7 +11,7 @@ class PeertubeMediaRenderer implements RendererInterface MediaRepresentation $media, array $options = []) { - $url = str_replace('watch', 'embed', $media->source()); + $url = $media->mediaData()['embedPath']; if (parse_url($url, PHP_URL_QUERY)) { $url .= '&peertubeLink=0'; } else {