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 {