Class: M3u8::PlaybackStart

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

Overview

PlaybackStart represents a #EXT-X-START tag and attributes

Constant Summary

Constants included from M3u8

VERSION

Instance Attribute 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(options = {}) ⇒ PlaybackStart

Returns a new instance of PlaybackStart.



8
9
10
11
12
# File 'lib/m3u8/playback_start.rb', line 8

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#preciseObject

Returns the value of attribute precise.



6
7
8
# File 'lib/m3u8/playback_start.rb', line 6

def precise
  @precise
end

#time_offsetObject

Returns the value of attribute time_offset.



6
7
8
# File 'lib/m3u8/playback_start.rb', line 6

def time_offset
  @time_offset
end

Instance Method Details

#parse(text) ⇒ Object



14
15
16
17
18
19
# File 'lib/m3u8/playback_start.rb', line 14

def parse(text)
  attributes = parse_attributes(text)
  @time_offset = attributes['TIME-OFFSET'].to_f
  precise = attributes['PRECISE']
  @precise = parse_yes_no(precise) unless precise.nil?
end

#to_sObject



21
22
23
24
25
# File 'lib/m3u8/playback_start.rb', line 21

def to_s
  attributes = ["TIME-OFFSET=#{time_offset}",
                precise_format].compact.join(',')
  "#EXT-X-START:#{attributes}"
end