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, bypass_transcoding: nil, url: 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
47
48
49
50
51
# File 'lib/livekit/ingress_service_client.rb', line 16

def create_ingress(
  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,
  # optional, whether to forward input media unprocessed, for WHIP only
  bypass_transcoding: nil,
  # optional, needed for ingresses of type URL, provides the URL to fetch media from
  url: 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,
    bypass_transcoding: bypass_transcoding,
    url: url,
  )
  self.rpc(
    :CreateIngress,
    request,
    headers: auth_header(ingressAdmin: true),
  )
end

#delete_ingress(ingress_id) ⇒ Object



104
105
106
107
108
109
110
111
112
113
# File 'lib/livekit/ingress_service_client.rb', line 104

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, ingress_id: nil) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/livekit/ingress_service_client.rb', line 87

def list_ingress(
  # optional, filter by room name
  room_name: nil,
  # optional, list by ingress id
  ingress_id: nil
)
  request = Proto::ListIngressRequest.new(
    room_name: room_name,
    ingress_id: ingress_id,
  )
  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, bypass_transcoding: nil) ⇒ Object



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
78
79
80
81
82
83
84
85
# File 'lib/livekit/ingress_service_client.rb', line 53

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,
  # optional, whether to forward input media unprocessed, for WHIP only
  bypass_transcoding: 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,
    bypass_transcoding: bypass_transcoding,
  )
  self.rpc(
    :UpdateIngress,
    request,
    headers: auth_header(ingressAdmin: true),
  )
end