Skip to content

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

Fix infohash for muxed live

Chocobozzz966d50beca60
diff --git a/packages/tests/src/shared/live.ts b/packages/tests/src/shared/live.ts
index f7defb5b10..27aafc58ec 100644
--- a/packages/tests/src/shared/live.ts
+++ b/packages/tests/src/shared/live.ts
@@ -81,9 +81,9 @@ async function testLiveVideoResolutions (options: {
} = options
// Live is always audio/video splitted
- const splittedAudio = transcoded
+ const splittedAudio = hasAudio && hasVideo
- const resolutions = splittedAudio && options.resolutions.length > 1 && !options.resolutions.includes(VideoResolution.H_NOVIDEO)
+ const resolutions = splittedAudio && options.resolutions.length !== 0 && !options.resolutions.includes(VideoResolution.H_NOVIDEO)
? [ VideoResolution.H_NOVIDEO, ...options.resolutions ]
: [ ...options.resolutions ]
diff --git a/server/core/lib/live/shared/muxing-session.ts b/server/core/lib/live/shared/muxing-session.ts
index 9bfeb99912..8a5be65c67 100644
--- a/server/core/lib/live/shared/muxing-session.ts
+++ b/server/core/lib/live/shared/muxing-session.ts
@@ -238,7 +238,12 @@ class MuxingSession extends EventEmitter implements MuxingSession {
)
}
- this.streamingPlaylist.assignP2PMediaLoaderInfoHashes(this.videoLive.Video, this.allResolutions.map(r => ({ height: r })))
+ const hlsStreams = [ ...this.allResolutions ]
+ if (this.hasAudio && this.hasVideo && !hlsStreams.includes(VideoResolution.H_NOVIDEO)) {
+ hlsStreams.push(VideoResolution.H_NOVIDEO)
+ }
+
+ this.streamingPlaylist.assignP2PMediaLoaderInfoHashes(this.videoLive.Video, Array.from(hlsStreams).map(r => ({ height: r })))
await this.streamingPlaylist.save()
} catch (err) {