Class: M3u8::PlaylistItem

Inherits:
Object
  • Object
show all
Includes:
M3u8
Defined in:
lib/m3u8/playlist_item.rb

Overview

PlaylistItem represents a set of EXT-X-STREAM-INF or EXT-X-I-FRAME-STREAM-INF attributes

Constant Summary

Constants included from M3u8

VERSION

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from M3u8

#intialize_with_byterange, #parse_attributes, #parse_float, #parse_yes_no, #to_yes_no

Constructor Details

#initialize(params = {}) ⇒ PlaylistItem

Returns a new instance of PlaylistItem.



12
13
14
15
16
17
# File 'lib/m3u8/playlist_item.rb', line 12

def initialize(params = {})
  self.iframe = false
  params.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#audioObject

Returns the value of attribute audio.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def audio
  @audio
end

#audio_codecObject

Returns the value of attribute audio_codec.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def audio_codec
  @audio_codec
end

#average_bandwidthObject

Returns the value of attribute average_bandwidth.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def average_bandwidth
  @average_bandwidth
end

#bandwidthObject

Returns the value of attribute bandwidth.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def bandwidth
  @bandwidth
end

#closed_captionsObject

Returns the value of attribute closed_captions.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def closed_captions
  @closed_captions
end

#codecsObject

Returns the value of attribute codecs.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def codecs
  @codecs
end

#frame_rateObject

Returns the value of attribute frame_rate.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def frame_rate
  @frame_rate
end

#hdcp_levelObject

Returns the value of attribute hdcp_level.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def hdcp_level
  @hdcp_level
end

#heightObject

Returns the value of attribute height.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def height
  @height
end

#iframeObject

Returns the value of attribute iframe.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def iframe
  @iframe
end

#levelObject

Returns the value of attribute level.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def level
  @level
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def name
  @name
end

#profileObject

Returns the value of attribute profile.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def profile
  @profile
end

#program_idObject

Returns the value of attribute program_id.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def program_id
  @program_id
end

#subtitlesObject

Returns the value of attribute subtitles.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def subtitles
  @subtitles
end

#uriObject

Returns the value of attribute uri.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def uri
  @uri
end

#videoObject

Returns the value of attribute video.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def video
  @video
end

#widthObject

Returns the value of attribute width.



7
8
9
# File 'lib/m3u8/playlist_item.rb', line 7

def width
  @width
end

Class Method Details

.parse(text) ⇒ Object



19
20
21
22
23
# File 'lib/m3u8/playlist_item.rb', line 19

def self.parse(text)
  item = PlaylistItem.new
  item.parse(text)
  item
end

Instance Method Details

#parse(text) ⇒ Object



25
26
27
28
29
# File 'lib/m3u8/playlist_item.rb', line 25

def parse(text)
  attributes = parse_attributes(text)
  options = options_from_attributes(attributes)
  initialize(options)
end

#resolutionObject



31
32
33
34
# File 'lib/m3u8/playlist_item.rb', line 31

def resolution
  return if width.nil?
  "#{width}x#{height}"
end

#to_sObject



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

def to_s
  m3u8_format
end