Class: WebRTC::VideoTrackSourceInterface
- Inherits:
-
Object
- Object
- WebRTC::VideoTrackSourceInterface
- Defined in:
- lib/webrtc/media_interfaces.rb
Instance Method Summary collapse
- #add_sink(sink) ⇒ Object
-
#initialize ⇒ VideoTrackSourceInterface
constructor
A new instance of VideoTrackSourceInterface.
- #push_frame(frame) ⇒ Object
- #remove_sink(sink) ⇒ Object
Constructor Details
#initialize ⇒ VideoTrackSourceInterface
Returns a new instance of VideoTrackSourceInterface.
68 69 70 |
# File 'lib/webrtc/media_interfaces.rb', line 68 def initialize @sinks = [] end |
Instance Method Details
#add_sink(sink) ⇒ Object
72 73 74 |
# File 'lib/webrtc/media_interfaces.rb', line 72 def add_sink(sink) @sinks << sink unless @sinks.include?(sink) end |
#push_frame(frame) ⇒ Object
80 81 82 |
# File 'lib/webrtc/media_interfaces.rb', line 80 def push_frame(frame) @sinks.each { |sink| sink.on_frame(frame) if sink.respond_to?(:on_frame) } end |
#remove_sink(sink) ⇒ Object
76 77 78 |
# File 'lib/webrtc/media_interfaces.rb', line 76 def remove_sink(sink) @sinks.delete(sink) end |