diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/live/shared/muxing-session.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts index 6632499ff..c9e5df906 100644 --- a/server/lib/live/shared/muxing-session.ts +++ b/server/lib/live/shared/muxing-session.ts | |||
@@ -184,11 +184,15 @@ class MuxingSession extends EventEmitter { | |||
184 | } | 184 | } |
185 | 185 | ||
186 | private watchMasterFile () { | 186 | private watchMasterFile () { |
187 | this.filesWatcher.on('add', async path => { | 187 | const watcher = this.filesWatcher.on('change', async path => { |
188 | if (path !== join(this.outDirectory, this.streamingPlaylist.playlistFilename)) return | 188 | if (path !== join(this.outDirectory, this.streamingPlaylist.playlistFilename)) return |
189 | if (this.masterPlaylistCreated === true) return | 189 | if (this.masterPlaylistCreated === true) return |
190 | 190 | ||
191 | try { | 191 | try { |
192 | const masterPlaylistContent = await readFile(path, 'utf8') | ||
193 | // Not generated yet | ||
194 | if (!masterPlaylistContent) return | ||
195 | |||
192 | if (this.streamingPlaylist.storage === VideoStorage.OBJECT_STORAGE) { | 196 | if (this.streamingPlaylist.storage === VideoStorage.OBJECT_STORAGE) { |
193 | const url = await storeHLSFileFromFilename(this.streamingPlaylist, this.streamingPlaylist.playlistFilename) | 197 | const url = await storeHLSFileFromFilename(this.streamingPlaylist, this.streamingPlaylist.playlistFilename) |
194 | 198 | ||
@@ -205,6 +209,9 @@ class MuxingSession extends EventEmitter { | |||
205 | this.masterPlaylistCreated = true | 209 | this.masterPlaylistCreated = true |
206 | 210 | ||
207 | logger.info('Master playlist file for %s has been created', this.videoUUID, this.lTags()) | 211 | logger.info('Master playlist file for %s has been created', this.videoUUID, this.lTags()) |
212 | |||
213 | watcher.close() | ||
214 | .catch(err => logger.error('Cannot close watcher', { err })) | ||
208 | }) | 215 | }) |
209 | } | 216 | } |
210 | 217 | ||