Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
== 8.1.0-beta.2 2025-07-17

Fixes:
* Added support for base URLs in HLS playlists generated via the `FFMPEG::DASH` classes.

== 8.1.0-beta.1 2025-07-17

Fixes:
Expand Down
5 changes: 4 additions & 1 deletion lib/ffmpeg/dash/adaptation_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def to_m3u8mt(group_id: content_type, default: true, autoselect: true)
return unless %w[audio video].include?(content_type)
return unless representations.any?

url = "stream#{representations.first.id}.m3u8"
url = URI.join(representations.first.base_url, url).to_s if representations.first.base_url

m3u8t(
'EXT-X-MEDIA',
'TYPE' => content_type.upcase,
Expand All @@ -112,7 +115,7 @@ def to_m3u8mt(group_id: content_type, default: true, autoselect: true)
'LANGUAGE' => quote(lang || 'und'),
'DEFAULT' => default ? 'YES' : 'NO',
'AUTOSELECT' => autoselect ? 'YES' : 'NO',
'URI' => quote("stream#{representations.first.id}.m3u8")
'URI' => quote(url)
)
end

Expand Down
5 changes: 4 additions & 1 deletion lib/ffmpeg/dash/representation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,17 @@ def to_m3u8
def to_m3u8si(audio_group_id: nil, video_group_id: nil)
return unless %w[audio video].include?(@adaptation_set.content_type)

url = "stream#{id}.m3u8"
url = URI.join(base_url, url).to_s if base_url

"#{m3u8t(
'EXT-X-STREAM-INF',
'BANDWIDTH' => bandwidth,
'CODECS' => quote(codecs),
'RESOLUTION' => resolution,
'AUDIO' => quote(audio_group_id),
'VIDEO' => quote(video_group_id)
)}\n#{"stream#{id}.m3u8"}"
)}\n#{url}"
end

private
Expand Down
2 changes: 1 addition & 1 deletion lib/ffmpeg/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module FFMPEG
VERSION = '8.1.0-beta.1'
VERSION = '8.1.0-beta.2'
end
9 changes: 9 additions & 0 deletions spec/ffmpeg/dash/manifest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,14 @@
M3U8
end
end

context 'with base URL set' do
it 'includes the base URL in the playlist URIs' do
manifest.base_url = 'http://example.com/'
is_expected.to include('http://example.com/stream0.m3u8')
is_expected.to include('http://example.com/stream1.m3u8')
is_expected.to include('http://example.com/stream2.m3u8')
end
end
end
end