Class: LiveKit::IngressServiceClient

Inherits:
Twirp::Client
  • Object
show all
Includes:
AuthMixin
Defined in:
lib/livekit/ingress_service_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AuthMixin

#auth_header

Constructor Details

#initialize(base_url, api_key: nil, api_secret: nil) ⇒ IngressServiceClient

Returns a new instance of IngressServiceClient.



10
11
12
13
14
# File 'lib/livekit/ingress_service_client.rb', line 10

def initialize(base_url, api_key: nil, api_secret: nil)
  super(File.join(base_url, "/twirp"))
  @api_key = api_key
  @api_secret = api_secret
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



8
9
10
# File 'lib/livekit/ingress_service_client.rb', line 8

def api_key
  @api_key
end

#api_secretObject

Returns the value of attribute api_secret.



8
9
10
# File 'lib/livekit/ingress_service_client.rb', line 8

def api_secret
  @api_secret
end

Instance Method Details

#create_ingress(input_type, name: nil, room_name: nil, participant_identity: nil, participant_name: nil, audio: nil, video: nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/livekit/ingress_service_client.rb', line 16

def create_ingress(
  # currently :RTMP_INPUT is the only supported type
  input_type,
  # optional, name to identify the ingress
  name: nil,
  # optional, you can attach to a room at a later time
  room_name: nil,
  # optional, identity of participant to publish as
  participant_identity: nil,
  # optional, display name of participant
  participant_name: nil,
  # optional, LiveKit::Proto::IngressAudioOptions
  audio: nil,
  # optional, LiveKit::Proto::IngressVideoOptions
  video: nil
)
  request = Proto::CreateIngressRequest.new(
    input_type: input_type,
    name: name,
    room_name: room_name,
    participant_identity: participant_identity,
    participant_name: participant_name,
    audio: audio,
    video: video,
  )
  self.rpc(
    :CreateIngress,
    request,
    headers: auth_header(ingressAdmin: true),
  )
end

#delete_ingress(ingress_id) ⇒ Object



90
91
92
93
94
95
96
97
98
99
# File 'lib/livekit/ingress_service_client.rb', line 90

def delete_ingress(ingress_id)
  request = Proto::DeleteIngressRequest.new(
    ingress_id: ingress_id
  )
  self.rpc(
    :DeleteIngress,
    request,
    headers: auth_header(ingressAdmin: true),
  )
end

#list_ingress(room_name: nil) ⇒ Object



79
80
81
82
83
84
85
86
87
88
# File 'lib/livekit/ingress_service_client.rb', line 79

def list_ingress(room_name: nil)
  request = Proto::ListIngressRequest.new(
    room_name: room_name,
  )
  self.rpc(
    :ListIngress,
    request,
    headers: auth_header(ingressAdmin: true),
  )
end

#update_ingress(ingress_id, name: nil, room_name: nil, participant_identity: nil, participant_name: nil, audio: nil, video: nil) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/livekit/ingress_service_client.rb', line 48

def update_ingress(
  ingress_id,
  # optional, name to identify the ingress
  name: nil,
  # optional, you can attach to a room at a later time
  room_name: nil,
  # optional, identity of participant to publish as
  participant_identity: nil,
  # optional, display name of participant
  participant_name: nil,
  # optional, LiveKit::Proto::IngressAudioOptions
  audio: nil,
  # optional, LiveKit::Proto::IngressVideoOptions
  video: nil
)
  request = Proto::UpdateIngressRequest.new(
    ingress_id: ingress_id,
    name: name,
    room_name: room_name,
    participant_identity: participant_identity,
    participant_name: participant_name,
    audio: audio,
    video: video,
  )
  self.rpc(
    :UpdateIngress,
    request,
    headers: auth_header(ingressAdmin: true),
  )
end