Class: WebRTC::RTCIceTransport
- Inherits:
-
Object
- Object
- WebRTC::RTCIceTransport
- Defined in:
- lib/webrtc/ice_transport.rb
Constant Summary collapse
- STATES =
%i[new checking connected completed failed disconnected closed].freeze
- GATHERING_STATES =
%i[new gathering complete].freeze
- ROLES =
%i[controlling controlled unknown].freeze
Instance Attribute Summary collapse
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#gathering_state ⇒ Object
readonly
Returns the value of attribute gathering_state.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #get_local_candidates ⇒ Object
- #get_local_parameters ⇒ Object
- #get_remote_candidates ⇒ Object
- #get_remote_parameters ⇒ Object
- #get_selected_candidate_pair ⇒ Object
-
#initialize(options = {}) ⇒ RTCIceTransport
constructor
A new instance of RTCIceTransport.
- #on_gathering_state_change(&block) ⇒ Object
- #on_selected_candidate_pair_change(&block) ⇒ Object
- #on_state_change(&block) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ RTCIceTransport
Returns a new instance of RTCIceTransport.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/webrtc/ice_transport.rb', line 11 def initialize( = {}) @state = :new @gathering_state = :new @role = [:role] || :unknown @component = [:component] || :rtp @local_candidates = [] @remote_candidates = [] @local_parameters = nil @remote_parameters = nil @callbacks = {} @ptr = [:ptr] end |
Instance Attribute Details
#component ⇒ Object (readonly)
Returns the value of attribute component.
9 10 11 |
# File 'lib/webrtc/ice_transport.rb', line 9 def component @component end |
#gathering_state ⇒ Object (readonly)
Returns the value of attribute gathering_state.
9 10 11 |
# File 'lib/webrtc/ice_transport.rb', line 9 def gathering_state @gathering_state end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
9 10 11 |
# File 'lib/webrtc/ice_transport.rb', line 9 def role @role end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
9 10 11 |
# File 'lib/webrtc/ice_transport.rb', line 9 def state @state end |
Instance Method Details
#get_local_candidates ⇒ Object
24 25 26 |
# File 'lib/webrtc/ice_transport.rb', line 24 def get_local_candidates @local_candidates.dup end |
#get_local_parameters ⇒ Object
32 33 34 |
# File 'lib/webrtc/ice_transport.rb', line 32 def get_local_parameters @local_parameters end |
#get_remote_candidates ⇒ Object
28 29 30 |
# File 'lib/webrtc/ice_transport.rb', line 28 def get_remote_candidates @remote_candidates.dup end |
#get_remote_parameters ⇒ Object
36 37 38 |
# File 'lib/webrtc/ice_transport.rb', line 36 def get_remote_parameters @remote_parameters end |
#get_selected_candidate_pair ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/webrtc/ice_transport.rb', line 40 def get_selected_candidate_pair return nil if @local_candidates.empty? || @remote_candidates.empty? RTCIceCandidatePair.new( local: @local_candidates.first, remote: @remote_candidates.first ) end |
#on_gathering_state_change(&block) ⇒ Object
53 54 55 |
# File 'lib/webrtc/ice_transport.rb', line 53 def on_gathering_state_change(&block) @callbacks[:gathering_state_change] = block end |
#on_selected_candidate_pair_change(&block) ⇒ Object
57 58 59 |
# File 'lib/webrtc/ice_transport.rb', line 57 def on_selected_candidate_pair_change(&block) @callbacks[:selected_candidate_pair_change] = block end |
#on_state_change(&block) ⇒ Object
49 50 51 |
# File 'lib/webrtc/ice_transport.rb', line 49 def on_state_change(&block) @callbacks[:state_change] = block end |