Class: JanusGateway::Plugin::Rtpbroadcast
- Inherits:
-
Resource::Plugin
- Object
- Resource
- Resource::Plugin
- JanusGateway::Plugin::Rtpbroadcast
- Defined in:
- lib/janus_gateway/plugin/rtpbroadcast.rb
Defined Under Namespace
Classes: Mountpoint
Instance Attribute Summary
Attributes inherited from Resource::Plugin
Attributes inherited from Resource
Instance Method Summary collapse
-
#initialize(client, session) ⇒ Rtpbroadcast
constructor
A new instance of Rtpbroadcast.
- #list ⇒ Concurrent::Promise
- #watch_udp(mountpoint_id, streams) ⇒ Concurrent::Promise
Methods inherited from Resource::Plugin
Methods inherited from Resource
Constructor Details
#initialize(client, session) ⇒ Rtpbroadcast
Returns a new instance of Rtpbroadcast.
5 6 7 |
# File 'lib/janus_gateway/plugin/rtpbroadcast.rb', line 5 def initialize(client, session) super(client, session, 'janus.plugin.cm.rtpbroadcast') end |
Instance Method Details
#list ⇒ 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/rtpbroadcast.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 |
#watch_udp(mountpoint_id, streams) ⇒ Concurrent::Promise
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/janus_gateway/plugin/rtpbroadcast.rb', line 41 def watch_udp(mountpoint_id, streams) promise = Concurrent::Promise.new client.send_transaction( janus: 'message', session_id: session.id, handle_id: id, body: { request: 'watch-udp', id: mountpoint_id, streams: streams } ).then do |data| if data['error_code'].nil? _on_success(data) promise.set(data).execute else error = JanusGateway::Error.new(data['error_code'], data['error']) _on_error(error) promise.fail(error).execute end end.rescue do |error| promise.fail(error).execute end promise end |