m3u8 v0.4.0: EXT-X-MEDIA support

There is a new release of the m3u8 gem available that includes support for EXT-X-MEDIA attributes. This extends the library to support features such as subtitles, closed captions, and alternate audio/video in master playlists. Several fixes and improvements have also been included from contributors recently and it is nice to see there is some interest in the project.

EXT-X-MEDIA is handled through the new MediaItem class:

hash = { type: 'AUDIO', group_id: 'audio-lo', language: 'fre',
         assoc_language: 'spoken', name: 'Francais', autoselect: true,
         default: false, forced: true, uri: 'frelo/prog_index.m3u8' }
item = M3u8::MediaItem.new(hash)

New attributes were also added to PlaylistItem (video, audio, subtitles, and closed_captions) to fully support EXT-X-MEDIA. These values will reference EXT-X-MEDIA tags with a GROUP-ID attribute of the same value. This is how the client knows what resource is available with each stream.

hash = { codecs: 'avc', bandwidth: 540000, playlist: 'lo/prog_index.m3u8',
         audio: 'audio-lo' }
item = M3u8::PlaylistItem.new(hash)

I have not included any validation with these new features because my intent is to overhaul the current validation logic once the all of the tags and attributes from the HLS spec are implemented.


Hi there, I'm Seth Deckard, a software developer with years of experience working in Ruby and Rails. I co-founded WarningAware and have authored several open source projects on GitHub. You can reach me on Twitter.