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, #rpc!

Constructor Details

#initialize(base_url, api_key: nil, api_secret: nil, token: nil, failover: true, connection: nil) ⇒ IngressServiceClient

Returns a new instance of IngressServiceClient.



12
13
14
15
16
17
# File 'lib/livekit/ingress_service_client.rb', line 12

def initialize(base_url, api_key: nil, api_secret: nil, token: nil, failover: true, connection: nil)
  super(connection || LiveKit::Failover.connection(base_url, failover))
  @api_key = api_key
  @api_secret = api_secret
  @token = token
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



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

def api_key
  @api_key
end

#api_secretObject

Returns the value of attribute api_secret.



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

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



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
52
53
54
55
56
57
58
# File 'lib/livekit/ingress_service_client.rb', line 19

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 [deprecated]
  bypass_transcoding: nil,
  # optional, whether to enable transcoding or forward the input media directly.
  # Transcoding is required for all input types except WHIP. For WHIP, the default is to not transcode.
  enable_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,
    enable_transcoding: enable_transcoding,
    url: url,
  )
  rpc!(
    :CreateIngress,
    request,
    headers:auth_header(video_grant: VideoGrant.new(ingressAdmin: true)),
  )
end

#delete_ingress(ingress_id) ⇒ Object



115
116
117
118
119
120
121
122
123
124
# File 'lib/livekit/ingress_service_client.rb', line 115

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

#list_ingress(room_name: nil, ingress_id: nil) ⇒ Object



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/livekit/ingress_service_client.rb', line 98

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,
  )
  rpc!(
    :ListIngress,
    request,
    headers:auth_header(video_grant: VideoGrant.new(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, enable_transcoding: nil) ⇒ Object



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
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/livekit/ingress_service_client.rb', line 60

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,
  # optional, whether to enable transcoding or forward the input media directly.
  # Transcoding is required for all input types except WHIP. For WHIP, the default is to not transcode.
  enable_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,
    enable_transcoding: enable_transcoding,
  )
  rpc!(
    :UpdateIngress,
    request,
    headers:auth_header(video_grant: VideoGrant.new(ingressAdmin: true)),
  )
end