Class: M3u8::PlaylistItem
- Inherits:
-
Object
- Object
- M3u8::PlaylistItem
- Defined in:
- lib/m3u8/playlist_item.rb
Constant Summary collapse
- MISSING_CODEC_MESSAGE =
'Audio or video codec info should be provided.'
Instance Attribute Summary collapse
-
#audio ⇒ Object
Returns the value of attribute audio.
-
#bitrate ⇒ Object
Returns the value of attribute bitrate.
-
#codecs ⇒ Object
Returns the value of attribute codecs.
-
#height ⇒ Object
Returns the value of attribute height.
-
#level ⇒ Object
Returns the value of attribute level.
-
#playlist ⇒ Object
Returns the value of attribute playlist.
-
#profile ⇒ Object
Returns the value of attribute profile.
-
#program_id ⇒ Object
Returns the value of attribute program_id.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ PlaylistItem
constructor
A new instance of PlaylistItem.
- #resolution ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ PlaylistItem
Returns a new instance of PlaylistItem.
7 8 9 10 11 |
# File 'lib/m3u8/playlist_item.rb', line 7 def initialize(params = {}) params.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#audio ⇒ Object
Returns the value of attribute audio.
3 4 5 |
# File 'lib/m3u8/playlist_item.rb', line 3 def audio @audio end |
#bitrate ⇒ Object
Returns the value of attribute bitrate.
3 4 5 |
# File 'lib/m3u8/playlist_item.rb', line 3 def bitrate @bitrate end |
#codecs ⇒ Object
Returns the value of attribute codecs.
3 4 5 |
# File 'lib/m3u8/playlist_item.rb', line 3 def codecs @codecs end |
#height ⇒ Object
Returns the value of attribute height.
3 4 5 |
# File 'lib/m3u8/playlist_item.rb', line 3 def height @height end |
#level ⇒ Object
Returns the value of attribute level.
3 4 5 |
# File 'lib/m3u8/playlist_item.rb', line 3 def level @level end |
#playlist ⇒ Object
Returns the value of attribute playlist.
3 4 5 |
# File 'lib/m3u8/playlist_item.rb', line 3 def playlist @playlist end |
#profile ⇒ Object
Returns the value of attribute profile.
3 4 5 |
# File 'lib/m3u8/playlist_item.rb', line 3 def profile @profile end |
#program_id ⇒ Object
Returns the value of attribute program_id.
3 4 5 |
# File 'lib/m3u8/playlist_item.rb', line 3 def program_id @program_id end |
#width ⇒ Object
Returns the value of attribute width.
3 4 5 |
# File 'lib/m3u8/playlist_item.rb', line 3 def width @width end |
Instance Method Details
#resolution ⇒ Object
13 14 15 16 |
# File 'lib/m3u8/playlist_item.rb', line 13 def resolution return if width.nil? "#{width}x#{height}" end |
#to_s ⇒ Object
35 36 37 38 39 |
# File 'lib/m3u8/playlist_item.rb', line 35 def to_s validate "#EXT-X-STREAM-INF:PROGRAM-ID=#{program_id},#{resolution_format}" + %(CODECS="#{codecs}",BANDWIDTH=#{bitrate}\n#{playlist}) end |