Skip to content

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

Fix tests

Chocobozzz4434e78c567f
diff --git a/packages/tests/src/shared/streaming-playlists.ts b/packages/tests/src/shared/streaming-playlists.ts
index 8a601266f2..b187ba47c6 100644
--- a/packages/tests/src/shared/streaming-playlists.ts
+++ b/packages/tests/src/shared/streaming-playlists.ts
@@ -145,8 +145,13 @@ async function completeCheckHlsPlaylist (options: {
expect(file.resolution.label).to.equal(resolution + 'p')
}
- expect(Math.min(file.height, file.width)).to.equal(resolution)
- expect(Math.max(file.height, file.width)).to.be.greaterThan(resolution)
+ if (resolution === 0) {
+ expect(file.height).to.equal(0)
+ expect(file.width).to.equal(0)
+ } else {
+ expect(Math.min(file.height, file.width)).to.equal(resolution)
+ expect(Math.max(file.height, file.width)).to.be.greaterThan(resolution)
+ }
expect(file.magnetUri).to.have.lengthOf.above(2)
await checkWebTorrentWorks(file.magnetUri)
diff --git a/packages/tests/src/shared/videos.ts b/packages/tests/src/shared/videos.ts
index ede4ecc6cf..3ad5852e66 100644
--- a/packages/tests/src/shared/videos.ts
+++ b/packages/tests/src/shared/videos.ts
@@ -104,8 +104,13 @@ export async function completeWebVideoFilesCheck (options: {
if (attributeFile.width !== undefined) expect(file.width).to.equal(attributeFile.width)
if (attributeFile.height !== undefined) expect(file.height).to.equal(attributeFile.height)
- expect(Math.min(file.height, file.width)).to.equal(file.resolution.id)
- expect(Math.max(file.height, file.width)).to.be.greaterThan(file.resolution.id)
+ if (file.resolution.id === VideoResolution.H_NOVIDEO) {
+ expect(file.height).to.equal(0)
+ expect(file.width).to.equal(0)
+ } else {
+ expect(Math.min(file.height, file.width)).to.equal(file.resolution.id)
+ expect(Math.max(file.height, file.width)).to.be.greaterThan(file.resolution.id)
+ }
if (attributeFile.size) {
const minSize = attributeFile.size - ((10 * attributeFile.size) / 100)
diff --git a/server/core/lib/video-file.ts b/server/core/lib/video-file.ts
index f5463363e9..70194aa93f 100644
--- a/server/core/lib/video-file.ts
+++ b/server/core/lib/video-file.ts
@@ -27,7 +27,10 @@ async function buildNewFile (options: {
})
if (await isAudioFile(path, probe)) {
+ videoFile.fps = 0
videoFile.resolution = VideoResolution.H_NOVIDEO
+ videoFile.width = 0
+ videoFile.height = 0
} else {
const dimensions = await getVideoStreamDimensionsInfo(path, probe)
videoFile.fps = await getVideoStreamFPS(path, probe)