Class: WebRTC::RTCStats

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

Constant Summary collapse

TYPES =
%i[
  codec inbound_rtp outbound_rtp remote_inbound_rtp remote_outbound_rtp
  media_source csrc peer_connection data_channel transceiver sender
  receiver transport candidate_pair local_candidate remote_candidate
  certificate ice_server
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ RTCStats

Returns a new instance of RTCStats.



54
55
56
57
58
# File 'lib/webrtc/stats_report.rb', line 54

def initialize(options = {})
  @id = options[:id] || generate_id
  @timestamp = options[:timestamp] || Time.now.to_f * 1000
  @type = options[:type]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



52
53
54
# File 'lib/webrtc/stats_report.rb', line 52

def id
  @id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



52
53
54
# File 'lib/webrtc/stats_report.rb', line 52

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



52
53
54
# File 'lib/webrtc/stats_report.rb', line 52

def type
  @type
end

Instance Method Details

#to_hObject



60
61
62
63
64
65
66
# File 'lib/webrtc/stats_report.rb', line 60

def to_h
  {
    id: @id,
    timestamp: @timestamp,
    type: @type
  }
end