Sha256: 55f2a0d53fb99c78c41348e2ce7245b5d63c73bd3896b1142d896c156a7b4166

Contents?: true

Size: 1.04 KB

Versions: 12

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Evostream
  module Events
    # Action inStreamCreated
    class InStreamCreated < Event
      def execute
        super do |type_flux|
          klass = "Evostream::Commands::Create#{type_flux.upcase}".constantize
          command = send(type_flux, type_flux)
          @result = Evostream.send_command(klass.new(command).cmd)
        end
      end

      private

      def hls(flux)
        {
          local_stream_names: stream_name,
          target_folder: target_folder(flux),
          cleanup_destination: 1,
          group_name: group_name(flux),
          keep_alive: 1,
          chunk_length: 1,
          playlist_length: 10,
          playlist_type: 'rolling'
        }
      end

      alias dash hls

      def target_folder(flux)
        "#{Evostream::Service.web_root}#{group_name(flux)}/#{stream_name}"
      end

      def group_name(type_flux)
        "#{Evostream::Service.name}#{type_flux}"
      end

      def stream_name
        "#{Evostream::Service.name}#{id_flux}"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
evostream-event-0.3.0 lib/evostream/event/event/events/in_stream_created.rb
evostream-event-0.3.0.pre.48 lib/evostream/event/event/events/in_stream_created.rb
evostream-event-0.2.7 lib/evostream/event/event/events/in_stream_created.rb
evostream-event-0.2.7.pre.44 lib/evostream/event/event/events/in_stream_created.rb
evostream-event-0.2.6 lib/evostream/event/event/events/in_stream_created.rb
evostream-event-0.2.6.pre.41 lib/evostream/event/event/events/in_stream_created.rb
evostream-event-0.2.6.pre.39 lib/evostream/event/event/events/in_stream_created.rb
evostream-event-0.2.5 lib/evostream/event/events/in_stream_created.rb
evostream-event-0.2.5.pre.35 lib/evostream/event/events/in_stream_created.rb
evostream-event-0.2.5.pre.34 lib/evostream/event/events/in_stream_created.rb
evostream-event-0.2.4 lib/evostream/event/events/in_stream_created.rb
evostream-event-0.2.4.pre.31 lib/evostream/event/events/in_stream_created.rb