+}
+
+// FIXME: refactor/merge model and video arguments
+function addVideoFilesInAPAcc (
+ acc: ActivityUrlObject[] | ActivityTagObject[],
+ model: MVideoAP | MStreamingPlaylistVideo,
+ video: MVideoWithHost,
+ baseUrlHttp: string,
+ baseUrlWs: string,
+ files: MVideoFile[]
+) {
+ const sortedFiles = [ ...files ]
+ .filter(f => !f.isLive())
+ .sort(sortByResolutionDesc)
+
+ for (const file of sortedFiles) {
+ acc.push({
+ type: 'Link',
+ mediaType: MIMETYPES.VIDEO.EXT_MIMETYPE[file.extname] as any,
+ href: file.getFileUrl(video),
+ height: file.resolution,
+ size: file.size,
+ fps: file.fps
+ })
+
+ acc.push({
+ type: 'Link',
+ rel: [ 'metadata', MIMETYPES.VIDEO.EXT_MIMETYPE[file.extname] ],
+ mediaType: 'application/json' as 'application/json',
+ href: getLocalVideoFileMetadataUrl(video, file),
+ height: file.resolution,
+ fps: file.fps
+ })
+
+ acc.push({
+ type: 'Link',
+ mediaType: 'application/x-bittorrent' as 'application/x-bittorrent',
+ href: file.getTorrentUrl(),
+ height: file.resolution
+ })
+
+ acc.push({
+ type: 'Link',
+ mediaType: 'application/x-bittorrent;x-scheme-handler/magnet' as 'application/x-bittorrent;x-scheme-handler/magnet',
+ href: generateMagnetUri(model, video, file, baseUrlHttp, baseUrlWs),
+ height: file.resolution