Class: JanusGateway::Plugin::Audioroom

Inherits:
Resource::Plugin show all
Defined in:
lib/janus_gateway/plugin/audioroom.rb

Instance Attribute Summary

Attributes inherited from Resource::Plugin

#name, #session

Attributes inherited from Resource

#client, #id

Instance Method Summary collapse

Methods inherited from Resource::Plugin

#create, #destroy

Methods inherited from Resource

#create, #destroy

Constructor Details

#initialize(client, session) ⇒ Audioroom

Returns a new instance of Audioroom.

Parameters:



5
6
7
# File 'lib/janus_gateway/plugin/audioroom.rb', line 5

def initialize(client, session)
  super(client, session, 'janus.plugin.cm.audioroom')
end

Instance Method Details

#listConcurrent::Promise

Returns:

  • (Concurrent::Promise)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/janus_gateway/plugin/audioroom.rb', line 10

def list
  promise = Concurrent::Promise.new

  client.send_transaction(
    janus: 'message',
    session_id: session.id,
    handle_id: id,
    body: { request: 'list' }
  ).then do |data|
    plugindata = data['plugindata']['data']
    if plugindata['error_code'].nil?
      _on_success(data)

      promise.set(data).execute
    else
      error = JanusGateway::Error.new(plugindata['error_code'], plugindata['error'])

      _on_error(error)

      promise.fail(error).execute
    end
  end.rescue do |error|
    promise.fail(error).execute
  end

  promise
end