Class: Pageflow::ZencoderVideoOutputDefinition::Playlist Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pageflow/zencoder_video_output_definition.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, attachment:, format:, min_size: nil) ⇒ Playlist

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Playlist.



514
515
516
517
518
519
520
# File 'lib/pageflow/zencoder_video_output_definition.rb', line 514

def initialize(label:, attachment:, format:, min_size: nil)
  @label = label
  @attachment = attachment
  @format = format
  @min_size = min_size
  @streams = []
end

Class Method Details

.build(**args) {|builder| ... } ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Yields:

  • (builder)


508
509
510
511
512
# File 'lib/pageflow/zencoder_video_output_definition.rb', line 508

def self.build(**args)
  builder = new(**args)
  yield builder
  builder.build_definition
end

Instance Method Details

#build_definitionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/pageflow/zencoder_video_output_definition.rb', line 530

def build_definition
  definition = {
    label: @label,
    streams: @streams,
    allow_skipped_sources: true,
    type: 'playlist',
    path: @attachment.path,
    public: 1
  }

  definition[:streaming_delivery_format] = @format if @format == 'dash'
  definition[:skip] = {min_size: @min_size} if @min_size

  definition
end

#from(source_definition, bandwidth: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



522
523
524
525
526
527
528
# File 'lib/pageflow/zencoder_video_output_definition.rb', line 522

def from(source_definition, bandwidth: nil)
  @streams << {
    source: source_definition[:label],
    path: @attachment.relative_path_to(source_definition[:path]),
    bandwidth:
  }.compact
end