Class: Ruflet::UI::Services::RufletServicesComponents::AudioRecorderControl

Inherits:
Control
  • Object
show all
Defined in:
lib/ruflet_ui/ruflet/ui/services/ruflet/audio_recorder_control.rb

Constant Summary collapse

TYPE =
"audiorecorder".freeze
WIRE =
"AudioRecorder".freeze
KEYWORDS =
[:configuration, :data, :key, :on_state_change, :on_stream, :on_upload].freeze

Constants inherited from Control

Control::HOST_EXPANDED_TYPES, Control::SCHEMA_METADATA_CACHE

Instance Attribute Summary

Attributes inherited from Control

#children, #id, #props, #runtime_page, #type, #wire_id

Instance Method Summary collapse

Methods inherited from Control

#attach_handler, #emit, generate_id, #has_handler?, #merge_props, #on, #to_patch

Constructor Details

#initialize(id: nil, configuration: nil, data: nil, key: nil, on_state_change: nil, on_stream: nil, on_upload: nil) ⇒ AudioRecorderControl

Returns a new instance of AudioRecorderControl.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ruflet_ui/ruflet/ui/services/ruflet/audio_recorder_control.rb', line 12

def initialize(id: nil, configuration: nil, data: nil, key: nil, on_state_change: nil, on_stream: nil, on_upload: nil)
  configuration ||= {}
  props = {}
  props[:configuration] = configuration
  props[:data] = data unless data.nil?
  props[:key] = key unless key.nil?
  props[:on_state_change] = on_state_change unless on_state_change.nil?
  props[:on_stream] = on_stream unless on_stream.nil?
  props[:on_upload] = on_upload unless on_upload.nil?
  super(type: TYPE, id: id, **props)
end

Instance Method Details

#is_supported_encoder(encoder, timeout: 10, on_result: nil) ⇒ Object



30
31
32
# File 'lib/ruflet_ui/ruflet/ui/services/ruflet/audio_recorder_control.rb', line 30

def is_supported_encoder(encoder, timeout: 10, on_result: nil)
  invoke_service("is_supported_encoder", args: { "encoder" => encoder }, timeout: timeout, on_result: on_result)
end

#start_recording(output_path: nil, configuration: nil, upload: nil, timeout: 10, on_result: nil) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/ruflet_ui/ruflet/ui/services/ruflet/audio_recorder_control.rb', line 34

def start_recording(output_path: nil, configuration: nil, upload: nil, timeout: 10, on_result: nil)
  configuration = props["configuration"] if configuration.nil?
  invoke_service(
    "start_recording",
    args: compact_args("output_path" => output_path, "configuration" => configuration, "upload" => upload),
    timeout: timeout,
    on_result: on_result
  )
end