- .sort((a, b) => {
- if (a.resolution.id < b.resolution.id) return 1
- if (a.resolution.id === b.resolution.id) return 0
- return -1
+}
+
+function addVideoFilesInAPAcc (
+ acc: ActivityUrlObject[] | ActivityTagObject[],
+ video: MVideo,
+ files: MVideoFile[]
+) {
+ const trackerUrls = video.getTrackerUrls()
+
+ 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