diff options
author | Chocobozzz <me@florianbigard.com> | 2023-06-29 14:20:03 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-06-29 14:20:03 +0200 |
commit | 9cd06903f4e83b67bde8bd558374c75127a86c39 (patch) | |
tree | 4d39b5b5ed3ee0a2bd6fe3f2fb453b78ed654c6d /server/models/video | |
parent | a2871364278143fdda180b595e6e74851f5242bf (diff) | |
download | PeerTube-9cd06903f4e83b67bde8bd558374c75127a86c39.tar.gz PeerTube-9cd06903f4e83b67bde8bd558374c75127a86c39.tar.zst PeerTube-9cd06903f4e83b67bde8bd558374c75127a86c39.zip |
Fix HLS playlist generation with 0 duration length
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video.ts | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 06aec1308..3a0d95b62 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -2016,7 +2016,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
2016 | } | 2016 | } |
2017 | 2017 | ||
2018 | getBandwidthBits (this: MVideo, videoFile: MVideoFile) { | 2018 | getBandwidthBits (this: MVideo, videoFile: MVideoFile) { |
2019 | if (!this.duration) throw new Error(`Cannot get bandwidth bits because video ${this.url} has duration of 0`) | 2019 | if (!this.duration) return videoFile.size |
2020 | 2020 | ||
2021 | return Math.ceil((videoFile.size * 8) / this.duration) | 2021 | return Math.ceil((videoFile.size * 8) / this.duration) |
2022 | } | 2022 | } |