class M3U8::SegmentItem

Overview

SegmentItem represents EXTINF attributes with the URI that follows, optionally allowing an EXT-X-BYTERANGE tag to be set.

Included Modules

Extended Modules

Defined in:

m3u8/segment_item.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(params : NamedTuple = NamedTuple.new) #
options = {
  duration:  10.991,
  segment:   "test.ts",
  comment:   "anything",
  byterange: {length: 4500, start: 600},
}
SegmentItem.new(options)

[View source]
def self.new(duration : Float64 | Nil = nil, segment : Nil | String = nil, comment : Nil | String = nil, byterange = nil, program_date_time = nil) #
SegmentItem.new

[View source]

Instance Method Detail

def byterange : ByteRange #

[View source]
def byterange=(byterange) #
item = SegmentItem.new
item.byterange = ByteRange.new(length: 4500, start: 600)
item.byterange = {length: 4500, start: 600}
item.byterange = "4500@600"
item.byterange # => #<M3U8::ByteRange......>

[View source]
def comment : String | Nil #

[View source]
def comment=(comment : String | Nil) #

[View source]
def duration : Float64 | Nil #

[View source]
def duration=(duration : Float64 | Nil) #

[View source]
def program_date_time : TimeItem #

[View source]
def program_date_time=(time) #
item = SegmentItem.new
item.program_date_time = TimeItem.new("2010-02-19T14:54:23Z")
item.program_date_time = TimeItem.new(Time.iso8601("2010-02-19T14:54:23.031Z"))
item.program_date_time = Time.iso8601("2010-02-19T14:54:23.031Z")
item.program_date_time = "2010-02-19T14:54:23.031Z"
item.program_date_time # => #<M3U8::TimeItem......>

[View source]
def segment : String | Nil #

[View source]
def segment=(segment : String | Nil) #

[View source]
def to_s #
options = {
  duration:  10.991,
  segment:   "test.ts",
  comment:   "anything",
  byterange: {length: 4500, start: 600},
}
SegmentItem.new(options).to_s
# => %(#EXTINF:10.991,anything\n#EXT-X-BYTERANGE:4500@600\ntest.ts)

[View source]