Class: WebRTC::MediaStreamTrack
- Inherits:
-
Object
- Object
- WebRTC::MediaStreamTrack
show all
- Defined in:
- lib/webrtc/media_stream_track.rb
Constant Summary
collapse
- KINDS =
%i[audio video].freeze
- READY_STATES =
%i[live ended].freeze
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of MediaStreamTrack.
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/webrtc/media_stream_track.rb', line 11
def initialize(options = {})
@id = options[:id] || generate_id
@kind = options[:kind]&.to_sym
@label = options[:label] || ''
@enabled = options.fetch(:enabled, true)
@muted = options.fetch(:muted, false)
@ready_state = :live
@content_hint = options[:content_hint] || ''
@callbacks = {}
@ptr = options[:ptr]
validate!
end
|
Instance Attribute Details
#content_hint ⇒ Object
Returns the value of attribute content_hint.
9
10
11
|
# File 'lib/webrtc/media_stream_track.rb', line 9
def content_hint
@content_hint
end
|
#enabled ⇒ Object
Returns the value of attribute enabled.
9
10
11
|
# File 'lib/webrtc/media_stream_track.rb', line 9
def enabled
@enabled
end
|
#id ⇒ Object
Returns the value of attribute id.
8
9
10
|
# File 'lib/webrtc/media_stream_track.rb', line 8
def id
@id
end
|
#kind ⇒ Object
Returns the value of attribute kind.
8
9
10
|
# File 'lib/webrtc/media_stream_track.rb', line 8
def kind
@kind
end
|
#label ⇒ Object
Returns the value of attribute label.
8
9
10
|
# File 'lib/webrtc/media_stream_track.rb', line 8
def label
@label
end
|
#muted ⇒ Object
Returns the value of attribute muted.
9
10
11
|
# File 'lib/webrtc/media_stream_track.rb', line 9
def muted
@muted
end
|
#ready_state ⇒ Object
Returns the value of attribute ready_state.
8
9
10
|
# File 'lib/webrtc/media_stream_track.rb', line 8
def ready_state
@ready_state
end
|
Instance Method Details
#apply_constraints(_constraints = {}) ⇒ Object
55
56
57
|
# File 'lib/webrtc/media_stream_track.rb', line 55
def apply_constraints(_constraints = {})
Promise.resolve(nil)
end
|
#clone ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'lib/webrtc/media_stream_track.rb', line 30
def clone
MediaStreamTrack.new(
kind: kind,
label: label,
enabled: enabled,
muted: muted,
content_hint: content_hint
)
end
|
#get_capabilities ⇒ Object
44
45
46
|
# File 'lib/webrtc/media_stream_track.rb', line 44
def get_capabilities
{}
end
|
#get_constraints ⇒ Object
40
41
42
|
# File 'lib/webrtc/media_stream_track.rb', line 40
def get_constraints
{}
end
|
#get_settings ⇒ Object
48
49
50
51
52
53
|
# File 'lib/webrtc/media_stream_track.rb', line 48
def get_settings
{
device_id: '',
group_id: ''
}
end
|
#on_ended(&block) ⇒ Object
59
60
61
|
# File 'lib/webrtc/media_stream_track.rb', line 59
def on_ended(&block)
@callbacks[:ended] = block
end
|
#on_mute(&block) ⇒ Object
63
64
65
|
# File 'lib/webrtc/media_stream_track.rb', line 63
def on_mute(&block)
@callbacks[:mute] = block
end
|
#on_unmute(&block) ⇒ Object
67
68
69
|
# File 'lib/webrtc/media_stream_track.rb', line 67
def on_unmute(&block)
@callbacks[:unmute] = block
end
|
#stop ⇒ Object
25
26
27
28
|
# File 'lib/webrtc/media_stream_track.rb', line 25
def stop
@ready_state = :ended
@callbacks[:ended]&.call
end
|