Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Include video file id in API

Chocobozzz12d84abeca49
diff --git a/server/models/video/formatter/video-format-utils.ts b/server/models/video/formatter/video-format-utils.ts
index fd02f8c641..e1b0eb6108 100644
--- a/server/models/video/formatter/video-format-utils.ts
+++ b/server/models/video/formatter/video-format-utils.ts
@@ -256,6 +256,8 @@ function videoFilesModelToFormattedJSON (
.sort(sortByResolutionDesc)
.map(videoFile => {
return {
+ id: videoFile.id,
+
resolution: {
id: videoFile.resolution,
label: videoFile.resolution === 0 ? 'Audio' : `${videoFile.resolution}p`
diff --git a/server/tests/shared/videos.ts b/server/tests/shared/videos.ts
index 989865a490..3ab2453920 100644
--- a/server/tests/shared/videos.ts
+++ b/server/tests/shared/videos.ts
@@ -115,6 +115,7 @@ async function completeVideoCheck (
// Transcoding enabled: extension will always be .mp4
if (attributes.files.length > 1) extension = '.mp4'
+ expect(file.id).to.exist
expect(file.magnetUri).to.have.lengthOf.above(2)
expect(file.torrentDownloadUrl).to.match(new RegExp(`http://${host}/download/torrents/${uuidRegex}-${file.resolution.id}.torrent`))
diff --git a/shared/models/videos/file/video-file.model.ts b/shared/models/videos/file/video-file.model.ts
index 0ea857e7ac..2bbff48eb6 100644
--- a/shared/models/videos/file/video-file.model.ts
+++ b/shared/models/videos/file/video-file.model.ts
@@ -3,6 +3,8 @@ import { VideoFileMetadata } from './video-file-metadata.model'
import { VideoResolution } from './video-resolution.enum'
export interface VideoFile {
+ id: number
+
resolution: VideoConstant<VideoResolution>
size: number // Bytes
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml
index 9745f68e98..3092a99609 100644
--- a/support/doc/api/openapi.yaml
+++ b/support/doc/api/openapi.yaml
@@ -5665,6 +5665,8 @@ components:
VideoFile:
readOnly: true
properties:
+ id:
+ $ref: '#/components/schemas/id'
magnetUri:
type: string
format: uri