Class: JanusGateway::Plugin::Rtpbroadcast::Mountpoint
- Defined in:
- lib/janus_gateway/plugin/rtpbroadcast/mountpoint.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
- #create ⇒ Concurrent::Promise
- #data ⇒ Hash, NilClass
- #destroy ⇒ Concurrent::Promise
-
#initialize(client, plugin, id, streams = nil) ⇒ Mountpoint
constructor
A new instance of Mountpoint.
- #plugin ⇒ JanusGateway::Resource::Plugin
- #session ⇒ JanusGateway::Resource::Session
- #streams ⇒ Array<Hash>
Methods inherited from Resource
Constructor Details
#initialize(client, plugin, id, streams = nil) ⇒ Mountpoint
Returns a new instance of Mountpoint.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/janus_gateway/plugin/rtpbroadcast/mountpoint.rb', line 9 def initialize(client, plugin, id, streams = nil) @plugin = plugin @id = id @data = nil @streams = streams || [ { :audio => 'yes', :video => 'yes', :audiopt => 111, :audiortpmap => 'opus/48000/2', :videopt => 100, :videortpmap => 'VP8/90000' } ] super(client) end |
Instance Method Details
#create ⇒ Concurrent::Promise
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/janus_gateway/plugin/rtpbroadcast/mountpoint.rb', line 29 def create promise = Concurrent::Promise.new client.send_transaction( { :janus => 'message', :session_id => plugin.session.id, :handle_id => plugin.id, :body => { :request => 'create', :id => id, :name => id, :description => id, :recorded => true, :streams => @streams } } ).then do |data| plugindata = data['plugindata']['data'] if plugindata['error_code'].nil? _on_created(data) promise.set(self).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 |
#data ⇒ Hash, NilClass
92 93 94 |
# File 'lib/janus_gateway/plugin/rtpbroadcast/mountpoint.rb', line 92 def data @data end |
#destroy ⇒ Concurrent::Promise
72 73 74 75 76 77 78 79 |
# File 'lib/janus_gateway/plugin/rtpbroadcast/mountpoint.rb', line 72 def destroy promise = Concurrent::Promise.new _on_destroyed promise.set(self).execute promise end |
#plugin ⇒ JanusGateway::Resource::Plugin
87 88 89 |
# File 'lib/janus_gateway/plugin/rtpbroadcast/mountpoint.rb', line 87 def plugin @plugin end |
#session ⇒ JanusGateway::Resource::Session
82 83 84 |
# File 'lib/janus_gateway/plugin/rtpbroadcast/mountpoint.rb', line 82 def session plugin.session end |
#streams ⇒ Array<Hash>
67 68 69 |
# File 'lib/janus_gateway/plugin/rtpbroadcast/mountpoint.rb', line 67 def streams !data.nil? ? data['data']['stream']['streams'] : [] end |