Class: Livelist::Segment

Inherits:
Object
  • Object
show all
Defined in:
lib/livelist/segment.rb

Overview

A Segment to playlist file

Instance Method Summary collapse

Constructor Details

#initialize(src, duration) ⇒ Segment

Returns a new instance of Segment.

Parameters:

  • src (String)

    src can be a URI or a file name

  • duration (Float)

    duration in seconds



8
9
10
11
# File 'lib/livelist/segment.rb', line 8

def initialize(src, duration)
  @src = src
  @duration = duration
end

Instance Method Details

#append(playlist) ⇒ Object

Append a new segment on playlist file

Parameters:



16
17
18
# File 'lib/livelist/segment.rb', line 16

def append(playlist)
  write(playlist) if File.exist? playlist.path
end

#hls_append(playlist) ⇒ Object

Append a new segment but removing the previous segment from playlist

Parameters:



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

def hls_append(playlist)
  hls_write(playlist) if File.exist? playlist.path
end