diff --git a/lib/hls_playlist.ex b/lib/hls_playlist.ex index 794af83..ebcff34 100644 --- a/lib/hls_playlist.ex +++ b/lib/hls_playlist.ex @@ -71,7 +71,7 @@ defmodule HlsPlaylist do #EXTM3U #EXT-X-VERSION:3 #EXT-X-ALLOW-CACHE:NO - #EXT-X-TARGETDURATION:#{Kernel.trunc(Float.floor(largest_segment))} + #EXT-X-TARGETDURATION:#{Kernel.trunc(Float.ceil(largest_segment))} #EXT-X-MEDIA-SEQUENCE:0 #EXT-X-PLAYLIST-TYPE:VOD #{Enum.join(Enum.reverse(segments), "\n")} diff --git a/test/hls_playlist_test.exs b/test/hls_playlist_test.exs index 1be31ce..7da716c 100644 --- a/test/hls_playlist_test.exs +++ b/test/hls_playlist_test.exs @@ -41,7 +41,7 @@ defmodule HlsPlaylistTest do #EXTM3U #EXT-X-VERSION:3 #EXT-X-ALLOW-CACHE:NO - #EXT-X-TARGETDURATION:4 + #EXT-X-TARGETDURATION:5 #EXT-X-MEDIA-SEQUENCE:0 #EXT-X-PLAYLIST-TYPE:VOD #EXTINF:4.166667,