Class: WebRTC::RTCRtpTransceiver

Inherits:
Object
  • Object
show all
Defined in:
lib/webrtc/rtp_transceiver.rb

Constant Summary collapse

DIRECTIONS =
%i[sendrecv sendonly recvonly inactive stopped].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ RTCRtpTransceiver

Returns a new instance of RTCRtpTransceiver.



10
11
12
13
14
15
16
17
18
19
# File 'lib/webrtc/rtp_transceiver.rb', line 10

def initialize(options = {})
  @mid = options[:mid]
  @sender = options[:sender] || RTCRtpSender.new
  @receiver = options[:receiver] || RTCRtpReceiver.new
  @direction = options[:direction] || :sendrecv
  @current_direction = nil
  @stopped = false
  @ptr = options[:ptr]
  @native_track_id = options[:native_track_id]
end

Instance Attribute Details

#current_directionObject (readonly)

Returns the value of attribute current_direction.



7
8
9
# File 'lib/webrtc/rtp_transceiver.rb', line 7

def current_direction
  @current_direction
end

#directionObject

Returns the value of attribute direction.



8
9
10
# File 'lib/webrtc/rtp_transceiver.rb', line 8

def direction
  @direction
end

#midObject (readonly)

Returns the value of attribute mid.



7
8
9
# File 'lib/webrtc/rtp_transceiver.rb', line 7

def mid
  @mid
end

#native_track_idObject (readonly)

Returns the value of attribute native_track_id.



7
8
9
# File 'lib/webrtc/rtp_transceiver.rb', line 7

def native_track_id
  @native_track_id
end

#receiverObject (readonly)

Returns the value of attribute receiver.



7
8
9
# File 'lib/webrtc/rtp_transceiver.rb', line 7

def receiver
  @receiver
end

#senderObject (readonly)

Returns the value of attribute sender.



7
8
9
# File 'lib/webrtc/rtp_transceiver.rb', line 7

def sender
  @sender
end

#stoppedObject (readonly)

Returns the value of attribute stopped.



7
8
9
# File 'lib/webrtc/rtp_transceiver.rb', line 7

def stopped
  @stopped
end

Instance Method Details

#set_codec_preferences(codecs) ⇒ Object



27
28
29
# File 'lib/webrtc/rtp_transceiver.rb', line 27

def set_codec_preferences(codecs)
  @codec_preferences = codecs
end

#stopObject



21
22
23
24
25
# File 'lib/webrtc/rtp_transceiver.rb', line 21

def stop
  @stopped = true
  @direction = :stopped
  @sender&.replace_track(nil)
end

#stopped?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/webrtc/rtp_transceiver.rb', line 31

def stopped?
  @stopped
end