remove token from hls url

- following PR #4263
This commit is contained in:
laxandrea 2025-08-19 15:29:49 +02:00
parent a89a24e48e
commit 2cc6e56bd1
2 changed files with 6 additions and 6 deletions

View File

@ -146,7 +146,7 @@ class Stream extends EventEmitter {
async generatePlaylist() { async generatePlaylist() {
await fs.ensureDir(this.streamPath) await fs.ensureDir(this.streamPath)
await hlsPlaylistGenerator(this.playlistPath, 'output', this.totalDuration, this.segmentLength, this.hlsSegmentType, this.userToken) await hlsPlaylistGenerator(this.playlistPath, 'output', this.totalDuration, this.segmentLength, this.hlsSegmentType)
return this.clientPlaylistUri return this.clientPlaylistUri
} }

View File

@ -1,6 +1,6 @@
const fs = require('../../libs/fsExtra') const fs = require('../../libs/fsExtra')
function getPlaylistStr(segmentName, duration, segmentLength, hlsSegmentType, token) { function getPlaylistStr(segmentName, duration, segmentLength, hlsSegmentType) {
var ext = hlsSegmentType === 'fmp4' ? 'm4s' : 'ts' var ext = hlsSegmentType === 'fmp4' ? 'm4s' : 'ts'
var lines = [ var lines = [
@ -18,18 +18,18 @@ function getPlaylistStr(segmentName, duration, segmentLength, hlsSegmentType, to
var lastSegment = duration - (numSegments * segmentLength) var lastSegment = duration - (numSegments * segmentLength)
for (let i = 0; i < numSegments; i++) { for (let i = 0; i < numSegments; i++) {
lines.push(`#EXTINF:6,`) lines.push(`#EXTINF:6,`)
lines.push(`${segmentName}-${i}.${ext}?token=${token}`) lines.push(`${segmentName}-${i}.${ext}`)
} }
if (lastSegment > 0) { if (lastSegment > 0) {
lines.push(`#EXTINF:${lastSegment},`) lines.push(`#EXTINF:${lastSegment},`)
lines.push(`${segmentName}-${numSegments}.${ext}?token=${token}`) lines.push(`${segmentName}-${numSegments}.${ext}`)
} }
lines.push('#EXT-X-ENDLIST') lines.push('#EXT-X-ENDLIST')
return lines.join('\n') return lines.join('\n')
} }
function generatePlaylist(outputPath, segmentName, duration, segmentLength, hlsSegmentType, token) { function generatePlaylist(outputPath, segmentName, duration, segmentLength, hlsSegmentType) {
var playlistStr = getPlaylistStr(segmentName, duration, segmentLength, hlsSegmentType, token) var playlistStr = getPlaylistStr(segmentName, duration, segmentLength, hlsSegmentType)
return fs.writeFile(outputPath, playlistStr) return fs.writeFile(outputPath, playlistStr)
} }
module.exports = generatePlaylist module.exports = generatePlaylist