]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/audio-only.ts
Add basic video editor support
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / audio-only.ts
index 15c3ae6d69efac9693d9c820fc66128f42cb65f1..e7e73d382374f37c1c396707416ad0b968e164cb 100644 (file)
@@ -2,15 +2,23 @@
 
 import 'mocha'
 import * as chai from 'chai'
-import { join } from 'path'
-import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils'
-import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
+import { getAudioStream, getVideoStreamDimensionsInfo } from '@server/helpers/ffmpeg'
+import {
+  cleanupTests,
+  createMultipleServers,
+  doubleFollow,
+  PeerTubeServer,
+  setAccessTokensToServers,
+  waitJobs
+} from '@shared/server-commands'
 
 const expect = chai.expect
 
 describe('Test audio only video transcoding', function () {
   let servers: PeerTubeServer[] = []
   let videoUUID: string
+  let webtorrentAudioFileUrl: string
+  let fragmentedAudioFileUrl: string
 
   before(async function () {
     this.timeout(120000)
@@ -20,6 +28,7 @@ describe('Test audio only video transcoding', function () {
         enabled: true,
         resolutions: {
           '0p': true,
+          '144p': false,
           '240p': true,
           '360p': false,
           '480p': false,
@@ -63,13 +72,18 @@ describe('Test audio only video transcoding', function () {
         expect(files[1].resolution.id).to.equal(240)
         expect(files[2].resolution.id).to.equal(0)
       }
+
+      if (server.serverNumber === 1) {
+        webtorrentAudioFileUrl = video.files[2].fileUrl
+        fragmentedAudioFileUrl = video.streamingPlaylists[0].files[2].fileUrl
+      }
     }
   })
 
   it('0p transcoded video should not have video', async function () {
     const paths = [
-      servers[0].servers.buildDirectory(join('videos', videoUUID + '-0.mp4')),
-      servers[0].servers.buildDirectory(join('streaming-playlists', 'hls', videoUUID, videoUUID + '-0-fragmented.mp4'))
+      servers[0].servers.buildWebTorrentFilePath(webtorrentAudioFileUrl),
+      servers[0].servers.buildFragmentedFilePath(videoUUID, fragmentedAudioFileUrl)
     ]
 
     for (const path of paths) {
@@ -77,9 +91,8 @@ describe('Test audio only video transcoding', function () {
       expect(audioStream['codec_name']).to.be.equal('aac')
       expect(audioStream['bit_rate']).to.be.at.most(384 * 8000)
 
-      const size = await getVideoStreamSize(path)
-      expect(size.height).to.equal(0)
-      expect(size.width).to.equal(0)
+      const size = await getVideoStreamDimensionsInfo(path)
+      expect(size).to.not.exist
     }
   })