Class: HLSMediaSegment

Inherits:
Object
  • Object
show all
Includes:
HLSConstants
Defined in:
lib/hls_manifest.rb

Constant Summary

Constants included from HLSConstants

HLSConstants::EXTINF, HLSConstants::EXTM3U, HLSConstants::EXT_X_ALLOW_CACHE, HLSConstants::EXT_X_CUE_IN, HLSConstants::EXT_X_CUE_OUT, HLSConstants::EXT_X_DISCONTINUITY, HLSConstants::EXT_X_ENDLIST, HLSConstants::EXT_X_FAXS_CM, HLSConstants::EXT_X_KEY, HLSConstants::EXT_X_KEY_ATTRS, HLSConstants::EXT_X_MEDIA, HLSConstants::EXT_X_MEDIA_SEQUENCE, HLSConstants::EXT_X_PLAYLIST_TYPE, HLSConstants::EXT_X_STREAM_INF, HLSConstants::EXT_X_STREAM_INF_ATTRS, HLSConstants::EXT_X_TARGETDURATION, HLSConstants::EXT_X_VERSION, HLSConstants::FIXNUM_MAX, HLSConstants::SUPPORTED_M3U8_VERSIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHLSMediaSegment

Returns a new instance of HLSMediaSegment.



62
63
64
65
66
67
68
69
# File 'lib/hls_manifest.rb', line 62

def initialize
  @show_key = true
  @discontinuity = false
  @duration = 0
  @cue_out_duration = FIXNUM_MAX
  @is_cue_out = false
  @is_cue_in = false
end

Instance Attribute Details

#cue_out_durationObject

Returns the value of attribute cue_out_duration.



57
58
59
# File 'lib/hls_manifest.rb', line 57

def cue_out_duration
  @cue_out_duration
end

#discontinuityObject

Returns the value of attribute discontinuity.



55
56
57
# File 'lib/hls_manifest.rb', line 55

def discontinuity
  @discontinuity
end

#durationObject

Returns the value of attribute duration.



52
53
54
# File 'lib/hls_manifest.rb', line 52

def duration
  @duration
end

#is_cue_inObject

Returns the value of attribute is_cue_in.



59
60
61
# File 'lib/hls_manifest.rb', line 59

def is_cue_in
  @is_cue_in
end

#is_cue_outObject

Returns the value of attribute is_cue_out.



58
59
60
# File 'lib/hls_manifest.rb', line 58

def is_cue_out
  @is_cue_out
end

#keyObject

Returns the value of attribute key.



50
51
52
# File 'lib/hls_manifest.rb', line 50

def key
  @key
end

#locationObject

Returns the value of attribute location.



54
55
56
# File 'lib/hls_manifest.rb', line 54

def location
  @location
end

#sequenceObject

Returns the value of attribute sequence.



60
61
62
# File 'lib/hls_manifest.rb', line 60

def sequence
  @sequence
end

#show_keyObject

Returns the value of attribute show_key.



51
52
53
# File 'lib/hls_manifest.rb', line 51

def show_key
  @show_key
end

#tagsObject

Returns the value of attribute tags.



56
57
58
# File 'lib/hls_manifest.rb', line 56

def tags
  @tags
end

#titleObject

Returns the value of attribute title.



53
54
55
# File 'lib/hls_manifest.rb', line 53

def title
  @title
end

Instance Method Details

#buildObject



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/hls_manifest.rb', line 71

def build
  return "" unless @location

  <<-EOT.remove_extra_spaces
    #{@tags.join("\n")}
    #{@discontinuity ? EXT_X_DISCONTINUITY : ""}
    #{@key.build if @key && @show_key}
    #{EXTINF}:#{@duration},#{@title}
    #{@location}
  EOT
end