Class: M3u8::Playlist
- Inherits:
-
Object
- Object
- M3u8::Playlist
- Defined in:
- lib/m3u8/playlist.rb
Overview
Playlist represents an m3u8 playlist, it can be a master playlist or a set of media segments
Instance Attribute Summary collapse
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#discontinuity_sequence ⇒ Object
Returns the value of attribute discontinuity_sequence.
-
#iframes_only ⇒ Object
Returns the value of attribute iframes_only.
-
#independent_segments ⇒ Object
Returns the value of attribute independent_segments.
-
#items ⇒ Object
Returns the value of attribute items.
-
#live ⇒ Object
Returns the value of attribute live.
-
#sequence ⇒ Object
Returns the value of attribute sequence.
-
#target ⇒ Object
Returns the value of attribute target.
-
#type ⇒ Object
Returns the value of attribute type.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #duration ⇒ Object
-
#initialize(options = {}) ⇒ Playlist
constructor
A new instance of Playlist.
- #live? ⇒ Boolean
- #master? ⇒ Boolean
- #to_s ⇒ Object
- #valid? ⇒ Boolean
- #write(output) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Playlist
Returns a new instance of Playlist.
10 11 12 13 |
# File 'lib/m3u8/playlist.rb', line 10 def initialize( = {}) () @items = [] end |
Instance Attribute Details
#cache ⇒ Object
Returns the value of attribute cache.
6 7 8 |
# File 'lib/m3u8/playlist.rb', line 6 def cache @cache end |
#discontinuity_sequence ⇒ Object
Returns the value of attribute discontinuity_sequence.
6 7 8 |
# File 'lib/m3u8/playlist.rb', line 6 def discontinuity_sequence @discontinuity_sequence end |
#iframes_only ⇒ Object
Returns the value of attribute iframes_only.
6 7 8 |
# File 'lib/m3u8/playlist.rb', line 6 def iframes_only @iframes_only end |
#independent_segments ⇒ Object
Returns the value of attribute independent_segments.
6 7 8 |
# File 'lib/m3u8/playlist.rb', line 6 def independent_segments @independent_segments end |
#items ⇒ Object
Returns the value of attribute items.
6 7 8 |
# File 'lib/m3u8/playlist.rb', line 6 def items @items end |
#live ⇒ Object
Returns the value of attribute live.
6 7 8 |
# File 'lib/m3u8/playlist.rb', line 6 def live @live end |
#sequence ⇒ Object
Returns the value of attribute sequence.
6 7 8 |
# File 'lib/m3u8/playlist.rb', line 6 def sequence @sequence end |
#target ⇒ Object
Returns the value of attribute target.
6 7 8 |
# File 'lib/m3u8/playlist.rb', line 6 def target @target end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/m3u8/playlist.rb', line 6 def type @type end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/m3u8/playlist.rb', line 6 def version @version end |
Class Method Details
.codecs(options = {}) ⇒ Object
15 16 17 18 |
# File 'lib/m3u8/playlist.rb', line 15 def self.codecs( = {}) item = PlaylistItem.new() item.codecs end |
Instance Method Details
#duration ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/m3u8/playlist.rb', line 52 def duration duration = 0.0 items.each do |item| duration += item.duration if item.is_a?(M3u8::SegmentItem) end duration end |
#live? ⇒ Boolean
30 31 32 33 |
# File 'lib/m3u8/playlist.rb', line 30 def live? return false if master? @live end |
#master? ⇒ Boolean
35 36 37 38 39 |
# File 'lib/m3u8/playlist.rb', line 35 def master? return @master unless @master.nil? return false if playlist_size.zero? && segment_size.zero? playlist_size > 0 end |
#to_s ⇒ Object
41 42 43 44 45 |
# File 'lib/m3u8/playlist.rb', line 41 def to_s output = StringIO.open write(output) output.string end |
#valid? ⇒ Boolean
47 48 49 50 |
# File 'lib/m3u8/playlist.rb', line 47 def valid? return false if playlist_size > 0 && segment_size > 0 true end |