Skip to content
/ m3u8 Public

Generate and parse m3u8 playlists for HTTP Live Streaming (HLS) in Crystal.

License

Notifications You must be signed in to change notification settings

akiicat/m3u8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

m3u8

Build Status Docs GitHub release

Generate and parse m3u8 playlists for HTTP Live Streaming (HLS).

Installation

Add this to your application's shard.yml:

dependencies:
  m3u8:
    github: akiicat/m3u8

Usage

require "m3u8"

module App
  include M3U8
end

Document

Generate

playlist = Playlist.new
playlist.items << SegmentItem.new(duration: 10.991, segment: "test_01.ts")
playlist.to_s
#EXTM3U
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:10
#EXTINF:10.991,
test_01.ts
#EXT-X-ENDLIST

Parse

file = File.read "spec/playlists/master.m3u8"
playlist = Playlist.parse(file)
playlist.master? # => true

Development

Supported Playlist Tags

Basic Tags

  • EXTM3U
  • EXT-X-VERSION

media segment tags

  • EXTINF
  • EXT-X-BYTERANGE
  • EXT-X-DISCONTINUITY
  • EXT-X-KEY
  • EXT-X-MAP
  • EXT-X-PROGRAM-DATE-TIME
  • EXT-X-DATERANGE

Media Playlist Tags

  • EXT-X-TARGETDURATION
  • EXT-X-MEDIA-SEQUENCE
  • EXT-X-DISCONTINUITY-SEQUENCE
  • EXT-X-ENDLIST
  • EXT-X-PLAYLIST-TYPE
  • EXT-X-I-FRAMES-ONLY
  • EXT-X-ALLOW-CACHE (was removed in protocol version 7)

Master Playlist Tags

  • EXT-X-MEDIA
  • EXT-X-STREAM-INF
  • EXT-X-I-FRAME-STREAM-INF
  • EXT-X-SESSION-DATA
  • EXT-X-SESSION-KEY

Media or Master Playlist Tags

  • EXT-X-INDEPENDENT-SEGMENTS
  • EXT-X-START

Experimental Tags

  • EXT-X-CUE-OUT
  • EXT-X-CUE-OUT-CONT
  • EXT-X-CUE-IN
  • EXT-X-CUE-SPAN
  • EXT-OATCLS-SCTE35

Contributing

  1. Fork it ( https://github.com/akiicat/m3u8/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • Akiicat Akiicat - creator, maintainer