Class: HLSPlaylist

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

Instance Attribute Details

#audioObject

Returns the value of attribute audio.



23
24
25
# File 'lib/hls_manifest.rb', line 23

def audio
  @audio
end

#bandwidthObject

Returns the value of attribute bandwidth.



19
20
21
# File 'lib/hls_manifest.rb', line 19

def bandwidth
  @bandwidth
end

#codecsObject

Returns the value of attribute codecs.



21
22
23
# File 'lib/hls_manifest.rb', line 21

def codecs
  @codecs
end

#locationObject

Returns the value of attribute location.



25
26
27
# File 'lib/hls_manifest.rb', line 25

def location
  @location
end

#program_idObject

Returns the value of attribute program_id.



20
21
22
# File 'lib/hls_manifest.rb', line 20

def program_id
  @program_id
end

#resolutionObject

Returns the value of attribute resolution.



22
23
24
# File 'lib/hls_manifest.rb', line 22

def resolution
  @resolution
end

#tagsObject

Returns the value of attribute tags.



26
27
28
# File 'lib/hls_manifest.rb', line 26

def tags
  @tags
end

#videoObject

Returns the value of attribute video.



24
25
26
# File 'lib/hls_manifest.rb', line 24

def video
  @video
end

Instance Method Details

#buildObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/hls_manifest.rb', line 28

def build
  return "" unless @location

  attributes = []
  attributes.push("#{EXT_X_STREAM_INF_ATTRS[:BANDWIDTH]}=#{@bandwidth}") if @bandwidth
  attributes.push("#{EXT_X_STREAM_INF_ATTRS[:PROGRAM_ID]}=#{@program_id}") if @program_id
  attributes.push("#{EXT_X_STREAM_INF_ATTRS[:CODECS]}=#{@codecs.join(",")}") if @codecs
  attributes.push("#{EXT_X_STREAM_INF_ATTRS[:RESOLUTION]}=#{@resolution}") if @resolution
  attributes.push("#{EXT_X_STREAM_INF_ATTRS[:AUDIO]}=#{@audio}") if @audio
  attributes.push("#{EXT_X_STREAM_INF_ATTRS[:VIDEO]}=#{@video}") if @video

  <<-EOT.remove_extra_spaces
    #{@tags.join("\n")}
    #{EXT_X_STREAM_INF + ":" + attributes.join(",") unless attributes.empty?}
    #{@location}
  EOT
end