From 22f18a4a197513c4cae685717829637cae853ae2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Feb 2020 09:19:56 +0100 Subject: Fix embed on mastodon --- server/models/video/video-format-utils.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index 2aa5b8677..67395e5c0 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts @@ -270,7 +270,15 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoTorrentObject { } } - const url: ActivityUrlObject[] = [] + const url: ActivityUrlObject[] = [ + // HTML url should be the first element in the array so Mastodon correctly displays the embed + { + type: 'Link', + mediaType: 'text/html', + href: WEBSERVER.URL + '/videos/watch/' + video.uuid + } + ] + addVideoFilesInAPAcc(url, video, baseUrlHttp, baseUrlWs, video.VideoFiles || []) for (const playlist of (video.VideoStreamingPlaylists || [])) { @@ -296,13 +304,6 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoTorrentObject { }) } - // Add video url too - url.push({ - type: 'Link', - mediaType: 'text/html', - href: WEBSERVER.URL + '/videos/watch/' + video.uuid - }) - const subtitleLanguage = [] for (const caption of video.VideoCaptions) { subtitleLanguage.push({ -- cgit v1.2.3