livekit-server-sdk 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df7cb873ae1dd034d26f58d9d678aeb0685aeb76aa582efe03c57aa662090388
4
- data.tar.gz: decdabaf87c8f3eb04e7c30371482bc84bf93dc304c5b43581dcfaf8eb61485c
3
+ metadata.gz: 7ca33e2d576356576a6fdffbb7ca8e7653f0dc5715138eb73fa63382c85d27cb
4
+ data.tar.gz: 76d47b446727732114c77ed92b412858f3087d71a23783af2a4aa6b677222168
5
5
  SHA512:
6
- metadata.gz: e9c750d3c53fe896219fd80ef30435839af5c806a80407d17a6536aaa9106e0f300f9db8fdab1a03cb730794db927173fd8a26959a60bebab22a3147a12c8e2b
7
- data.tar.gz: 20d6ee54faa5ad39c4155d1d5d62906926c5222e1a40ca1346c7a2ef6e15f6ade65eb54ea08d0e4303c3018b5b8e814b8e763d4211e6a1d35749799432ffe10d
6
+ metadata.gz: 3dac51a33c69794ca2eddfff9b35c375b6cbbc0578a3273cb4ba10088b3e6d056e77db02a7092a7b97f62123e84795c8a3dd273606a1e92a438ed155a0a54412
7
+ data.tar.gz: c5d71a01a978d34cb383b57c2df3120e4dff745d691e6a4d78cf947e6fa3c156bbfc098b0b2b4aa99f69a44d0ec72059892cc87a57cbc40c11dc82eb55fe5471
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ /.idea/
1
2
  /.bundle/
2
3
  /.yardoc
3
4
  /_yardoc/
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.8
1
+ 3.1.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- livekit-server-sdk (0.3.0)
4
+ livekit-server-sdk (0.4.0)
5
5
  google-protobuf (~> 3.21.0)
6
6
  jwt (~> 2.2.3)
7
7
  twirp (~> 1.9.0)
@@ -11,7 +11,7 @@ GEM
11
11
  specs:
12
12
  coderay (1.1.3)
13
13
  diff-lcs (1.5.0)
14
- faraday (1.10.0)
14
+ faraday (1.10.2)
15
15
  faraday-em_http (~> 1.0)
16
16
  faraday-em_synchrony (~> 1.0)
17
17
  faraday-excon (~> 1.1)
@@ -34,7 +34,7 @@ GEM
34
34
  faraday-patron (1.0.0)
35
35
  faraday-rack (1.0.0)
36
36
  faraday-retry (1.0.3)
37
- google-protobuf (3.21.1)
37
+ google-protobuf (3.21.7)
38
38
  jwt (2.2.3)
39
39
  method_source (1.0.0)
40
40
  multipart-post (2.2.3)
@@ -79,4 +79,4 @@ DEPENDENCIES
79
79
  yard
80
80
 
81
81
  BUNDLED WITH
82
- 2.3.4
82
+ 2.3.7
data/Rakefile CHANGED
@@ -13,6 +13,7 @@ task :proto do
13
13
  "--twirp_ruby_out=lib/livekit/proto",
14
14
  "-Iprotocol",
15
15
  "./protocol/livekit_egress.proto",
16
+ "./protocol/livekit_ingress.proto",
16
17
  "./protocol/livekit_models.proto",
17
18
  "./protocol/livekit_room.proto",
18
19
  "./protocol/livekit_webhook.proto")
@@ -15,7 +15,7 @@ module LiveKit
15
15
 
16
16
  def start_room_composite_egress(
17
17
  room_name,
18
- # one of EncodedFileOutput or StreamOutput
18
+ # one of EncodedFileOutput, SegmentedFileOutput or StreamOutput
19
19
  output,
20
20
  # EncodingOptionsPreset, only one of preset or advanced could be set
21
21
  preset: nil,
@@ -49,7 +49,7 @@ module LiveKit
49
49
 
50
50
  def start_track_composite_egress(
51
51
  room_name,
52
- # one of EncodedFileOutput or StreamOutput
52
+ # one of EncodedFileOutput, SegmentedFileOutput or StreamOutput
53
53
  output,
54
54
  # TrackID of an audio track
55
55
  audio_track_id: nil,
@@ -97,6 +97,33 @@ module LiveKit
97
97
  )
98
98
  end
99
99
 
100
+ def start_web_egress(
101
+ url,
102
+ # one of EncodedFileOutput, SegmentedFileOutput or StreamOutput
103
+ output,
104
+ # EncodingOptionsPreset, only one of preset or advanced could be set
105
+ preset: nil,
106
+ # EncodingOptions, only one of preset or advanced could be set
107
+ advanced: nil,
108
+ # true to record only audio
109
+ audio_only: false,
110
+ # true to record only video
111
+ video_only: false
112
+ )
113
+ request = Proto::WebEgressRequest.new(
114
+ url: url,
115
+ preset: preset,
116
+ advanced: advanced,
117
+ audio_only: audio_only,
118
+ video_only: video_only,
119
+ )
120
+ self.set_output(request, output)
121
+ self.rpc(
122
+ :StartWebEgress,
123
+ request,
124
+ headers: auth_header(roomRecord: true),
125
+ )
126
+ end
100
127
 
101
128
  def update_layout(egress_id, layout)
102
129
  self.rpc(
@@ -148,8 +175,10 @@ module LiveKit
148
175
  if output.nil?
149
176
  raise "output cannot be nil"
150
177
  end
151
- if output.filepath
178
+ if output.is_a? LiveKit::Proto::EncodedFileOutput or output.is_a? LiveKit::Proto::DirectFileOutput
152
179
  request.file = output
180
+ elsif output.is_a? LiveKit::Proto::SegmentedFileOutput
181
+ request.segments = output
153
182
  else
154
183
  request.stream = output
155
184
  end
@@ -34,7 +34,8 @@ module LiveKit
34
34
 
35
35
  class VideoGrant
36
36
  attr_accessor :roomCreate, :roomJoin, :roomList, :roomRecord, :roomAdmin,
37
- :room, :canPublish, :canSubscribe, :canPublishData, :hidden, :recorder
37
+ :room, :canPublish, :canSubscribe, :canPublishData, :hidden, :recorder,
38
+ :ingressAdmin
38
39
 
39
40
  def initialize(
40
41
  # true if can create or delete rooms
@@ -58,7 +59,9 @@ module LiveKit
58
59
  # if participant should remain invisible to others
59
60
  hidden: nil,
60
61
  # if participant is recording the room
61
- recorder: nil
62
+ recorder: nil,
63
+ # can create and manage Ingress
64
+ ingressAdmin: nil
62
65
  )
63
66
  @roomCreate = roomCreate
64
67
  @roomJoin = roomJoin
@@ -71,6 +74,7 @@ module LiveKit
71
74
  @canPublishData = canPublishData
72
75
  @hidden = hidden
73
76
  @recorder = recorder
77
+ @ingressAdmin = ingressAdmin
74
78
  end
75
79
 
76
80
  def self.from_hash(hash)
@@ -90,6 +94,7 @@ module LiveKit
90
94
  canPublishData: hash["canPublishData"],
91
95
  hidden: hash["hidden"],
92
96
  recorder: hash["recorder"],
97
+ ingressAdmin: hash["ingressAdmin"]
93
98
  )
94
99
  end
95
100
 
@@ -0,0 +1,101 @@
1
+ require "livekit/proto/livekit_ingress_twirp"
2
+ require "livekit/auth_mixin"
3
+
4
+ module LiveKit
5
+ class IngressServiceClient < Twirp::Client
6
+ client_for Proto::IngressService
7
+ include AuthMixin
8
+ attr_accessor :api_key, :api_secret
9
+
10
+ def initialize(base_url, api_key: nil, api_secret: nil)
11
+ super(File.join(base_url, "/twirp"))
12
+ @api_key = api_key
13
+ @api_secret = api_secret
14
+ end
15
+
16
+ def create_ingress(
17
+ # currently :RTMP_INPUT is the only supported type
18
+ input_type,
19
+ # optional, name to identify the ingress
20
+ name: nil,
21
+ # optional, you can attach to a room at a later time
22
+ room_name: nil,
23
+ # optional, identity of participant to publish as
24
+ participant_identity: nil,
25
+ # optional, display name of participant
26
+ participant_name: nil,
27
+ # optional, LiveKit::Proto::IngressAudioOptions
28
+ audio: nil,
29
+ # optional, LiveKit::Proto::IngressVideoOptions
30
+ video: nil
31
+ )
32
+ request = Proto::CreateIngressRequest.new(
33
+ input_type: input_type,
34
+ name: name,
35
+ room_name: room_name,
36
+ participant_identity: participant_identity,
37
+ participant_name: participant_name,
38
+ audio: audio,
39
+ video: video,
40
+ )
41
+ self.rpc(
42
+ :CreateIngress,
43
+ request,
44
+ headers: auth_header(ingressAdmin: true),
45
+ )
46
+ end
47
+
48
+ def update_ingress(
49
+ ingress_id,
50
+ # optional, name to identify the ingress
51
+ name: nil,
52
+ # optional, you can attach to a room at a later time
53
+ room_name: nil,
54
+ # optional, identity of participant to publish as
55
+ participant_identity: nil,
56
+ # optional, display name of participant
57
+ participant_name: nil,
58
+ # optional, LiveKit::Proto::IngressAudioOptions
59
+ audio: nil,
60
+ # optional, LiveKit::Proto::IngressVideoOptions
61
+ video: nil
62
+ )
63
+ request = Proto::UpdateIngressRequest.new(
64
+ ingress_id: ingress_id,
65
+ name: name,
66
+ room_name: room_name,
67
+ participant_identity: participant_identity,
68
+ participant_name: participant_name,
69
+ audio: audio,
70
+ video: video,
71
+ )
72
+ self.rpc(
73
+ :UpdateIngress,
74
+ request,
75
+ headers: auth_header(ingressAdmin: true),
76
+ )
77
+ end
78
+
79
+ def list_ingress(room_name: nil)
80
+ request = Proto::ListIngressRequest.new(
81
+ room_name: room_name,
82
+ )
83
+ self.rpc(
84
+ :ListIngress,
85
+ request,
86
+ headers: auth_header(ingressAdmin: true),
87
+ )
88
+ end
89
+
90
+ def delete_ingress(ingress_id)
91
+ request = Proto::DeleteIngressRequest.new(
92
+ ingress_id: ingress_id
93
+ )
94
+ self.rpc(
95
+ :DeleteIngress,
96
+ request,
97
+ headers: auth_header(ingressAdmin: true),
98
+ )
99
+ end
100
+ end
101
+ end
@@ -43,13 +43,29 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
43
43
  optional :websocket_url, :string, 4
44
44
  end
45
45
  end
46
+ add_message "livekit.WebEgressRequest" do
47
+ optional :url, :string, 1
48
+ optional :audio_only, :bool, 2
49
+ optional :video_only, :bool, 3
50
+ oneof :output do
51
+ optional :file, :message, 4, "livekit.EncodedFileOutput"
52
+ optional :stream, :message, 5, "livekit.StreamOutput"
53
+ optional :segments, :message, 6, "livekit.SegmentedFileOutput"
54
+ end
55
+ oneof :options do
56
+ optional :preset, :enum, 7, "livekit.EncodingOptionsPreset"
57
+ optional :advanced, :message, 8, "livekit.EncodingOptions"
58
+ end
59
+ end
46
60
  add_message "livekit.EncodedFileOutput" do
47
61
  optional :file_type, :enum, 1, "livekit.EncodedFileType"
48
62
  optional :filepath, :string, 2
63
+ optional :disable_manifest, :bool, 6
49
64
  oneof :output do
50
65
  optional :s3, :message, 3, "livekit.S3Upload"
51
66
  optional :gcp, :message, 4, "livekit.GCPUpload"
52
67
  optional :azure, :message, 5, "livekit.AzureBlobUpload"
68
+ optional :aliOSS, :message, 7, "livekit.AliOSSUpload"
53
69
  end
54
70
  end
55
71
  add_message "livekit.SegmentedFileOutput" do
@@ -57,18 +73,22 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
57
73
  optional :filename_prefix, :string, 2
58
74
  optional :playlist_name, :string, 3
59
75
  optional :segment_duration, :uint32, 4
76
+ optional :disable_manifest, :bool, 8
60
77
  oneof :output do
61
78
  optional :s3, :message, 5, "livekit.S3Upload"
62
79
  optional :gcp, :message, 6, "livekit.GCPUpload"
63
80
  optional :azure, :message, 7, "livekit.AzureBlobUpload"
81
+ optional :aliOSS, :message, 9, "livekit.AliOSSUpload"
64
82
  end
65
83
  end
66
84
  add_message "livekit.DirectFileOutput" do
67
85
  optional :filepath, :string, 1
86
+ optional :disable_manifest, :bool, 5
68
87
  oneof :output do
69
88
  optional :s3, :message, 2, "livekit.S3Upload"
70
89
  optional :gcp, :message, 3, "livekit.GCPUpload"
71
90
  optional :azure, :message, 4, "livekit.AzureBlobUpload"
91
+ optional :aliOSS, :message, 6, "livekit.AliOSSUpload"
72
92
  end
73
93
  end
74
94
  add_message "livekit.S3Upload" do
@@ -77,6 +97,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
77
97
  optional :region, :string, 3
78
98
  optional :endpoint, :string, 4
79
99
  optional :bucket, :string, 5
100
+ optional :force_path_style, :bool, 6
101
+ map :metadata, :string, :string, 7
102
+ optional :tagging, :string, 8
80
103
  end
81
104
  add_message "livekit.GCPUpload" do
82
105
  optional :credentials, :bytes, 1
@@ -87,6 +110,13 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
87
110
  optional :account_key, :string, 2
88
111
  optional :container_name, :string, 3
89
112
  end
113
+ add_message "livekit.AliOSSUpload" do
114
+ optional :access_key, :string, 1
115
+ optional :secret, :string, 2
116
+ optional :region, :string, 3
117
+ optional :endpoint, :string, 4
118
+ optional :bucket, :string, 5
119
+ end
90
120
  add_message "livekit.StreamOutput" do
91
121
  optional :protocol, :enum, 1, "livekit.StreamProtocol"
92
122
  repeated :urls, :string, 2
@@ -123,6 +153,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
123
153
  add_message "livekit.EgressInfo" do
124
154
  optional :egress_id, :string, 1
125
155
  optional :room_id, :string, 2
156
+ optional :room_name, :string, 13
126
157
  optional :status, :enum, 3, "livekit.EgressStatus"
127
158
  optional :started_at, :int64, 10
128
159
  optional :ended_at, :int64, 11
@@ -131,6 +162,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
131
162
  optional :room_composite, :message, 4, "livekit.RoomCompositeEgressRequest"
132
163
  optional :track_composite, :message, 5, "livekit.TrackCompositeEgressRequest"
133
164
  optional :track, :message, 6, "livekit.TrackEgressRequest"
165
+ optional :web, :message, 14, "livekit.WebEgressRequest"
134
166
  end
135
167
  oneof :result do
136
168
  optional :stream, :message, 7, "livekit.StreamInfoList"
@@ -143,10 +175,20 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
143
175
  end
144
176
  add_message "livekit.StreamInfo" do
145
177
  optional :url, :string, 1
178
+ optional :started_at, :int64, 2
179
+ optional :ended_at, :int64, 3
146
180
  optional :duration, :int64, 4
181
+ optional :status, :enum, 5, "livekit.StreamInfo.Status"
182
+ end
183
+ add_enum "livekit.StreamInfo.Status" do
184
+ value :ACTIVE, 0
185
+ value :FINISHED, 1
186
+ value :FAILED, 2
147
187
  end
148
188
  add_message "livekit.FileInfo" do
149
189
  optional :filename, :string, 1
190
+ optional :started_at, :int64, 2
191
+ optional :ended_at, :int64, 3
150
192
  optional :duration, :int64, 6
151
193
  optional :size, :int64, 4
152
194
  optional :location, :string, 5
@@ -157,6 +199,17 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
157
199
  optional :size, :int64, 3
158
200
  optional :playlist_location, :string, 4
159
201
  optional :segment_count, :int64, 5
202
+ optional :started_at, :int64, 6
203
+ optional :ended_at, :int64, 7
204
+ end
205
+ add_message "livekit.AutoTrackEgress" do
206
+ optional :filepath, :string, 1
207
+ optional :disable_manifest, :bool, 5
208
+ oneof :output do
209
+ optional :s3, :message, 2, "livekit.S3Upload"
210
+ optional :gcp, :message, 3, "livekit.GCPUpload"
211
+ optional :azure, :message, 4, "livekit.AzureBlobUpload"
212
+ end
160
213
  end
161
214
  add_enum "livekit.EncodedFileType" do
162
215
  value :DEFAULT_FILETYPE, 0
@@ -187,6 +240,10 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
187
240
  value :H264_720P_60, 1
188
241
  value :H264_1080P_30, 2
189
242
  value :H264_1080P_60, 3
243
+ value :PORTRAIT_H264_720P_30, 4
244
+ value :PORTRAIT_H264_720P_60, 5
245
+ value :PORTRAIT_H264_1080P_30, 6
246
+ value :PORTRAIT_H264_1080P_60, 7
190
247
  end
191
248
  add_enum "livekit.EgressStatus" do
192
249
  value :EGRESS_STARTING, 0
@@ -195,6 +252,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
195
252
  value :EGRESS_COMPLETE, 3
196
253
  value :EGRESS_FAILED, 4
197
254
  value :EGRESS_ABORTED, 5
255
+ value :EGRESS_LIMIT_REACHED, 6
198
256
  end
199
257
  end
200
258
  end
@@ -204,12 +262,14 @@ module LiveKit
204
262
  RoomCompositeEgressRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.RoomCompositeEgressRequest").msgclass
205
263
  TrackCompositeEgressRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.TrackCompositeEgressRequest").msgclass
206
264
  TrackEgressRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.TrackEgressRequest").msgclass
265
+ WebEgressRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.WebEgressRequest").msgclass
207
266
  EncodedFileOutput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.EncodedFileOutput").msgclass
208
267
  SegmentedFileOutput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.SegmentedFileOutput").msgclass
209
268
  DirectFileOutput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.DirectFileOutput").msgclass
210
269
  S3Upload = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.S3Upload").msgclass
211
270
  GCPUpload = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.GCPUpload").msgclass
212
271
  AzureBlobUpload = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.AzureBlobUpload").msgclass
272
+ AliOSSUpload = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.AliOSSUpload").msgclass
213
273
  StreamOutput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.StreamOutput").msgclass
214
274
  EncodingOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.EncodingOptions").msgclass
215
275
  UpdateLayoutRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.UpdateLayoutRequest").msgclass
@@ -220,8 +280,10 @@ module LiveKit
220
280
  EgressInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.EgressInfo").msgclass
221
281
  StreamInfoList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.StreamInfoList").msgclass
222
282
  StreamInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.StreamInfo").msgclass
283
+ StreamInfo::Status = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.StreamInfo.Status").enummodule
223
284
  FileInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.FileInfo").msgclass
224
285
  SegmentsInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.SegmentsInfo").msgclass
286
+ AutoTrackEgress = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.AutoTrackEgress").msgclass
225
287
  EncodedFileType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.EncodedFileType").enummodule
226
288
  StreamProtocol = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.StreamProtocol").enummodule
227
289
  SegmentedFileProtocol = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.SegmentedFileProtocol").enummodule
@@ -10,6 +10,7 @@ module LiveKit
10
10
  rpc :StartRoomCompositeEgress, RoomCompositeEgressRequest, EgressInfo, :ruby_method => :start_room_composite_egress
11
11
  rpc :StartTrackCompositeEgress, TrackCompositeEgressRequest, EgressInfo, :ruby_method => :start_track_composite_egress
12
12
  rpc :StartTrackEgress, TrackEgressRequest, EgressInfo, :ruby_method => :start_track_egress
13
+ rpc :StartWebEgress, WebEgressRequest, EgressInfo, :ruby_method => :start_web_egress
13
14
  rpc :UpdateLayout, UpdateLayoutRequest, EgressInfo, :ruby_method => :update_layout
14
15
  rpc :UpdateStream, UpdateStreamRequest, EgressInfo, :ruby_method => :update_stream
15
16
  rpc :ListEgress, ListEgressRequest, ListEgressResponse, :ruby_method => :list_egress
@@ -0,0 +1,113 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: livekit_ingress.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'livekit_models_pb'
7
+
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ add_file("livekit_ingress.proto", :syntax => :proto3) do
10
+ add_message "livekit.CreateIngressRequest" do
11
+ optional :input_type, :enum, 1, "livekit.IngressInput"
12
+ optional :name, :string, 2
13
+ optional :room_name, :string, 3
14
+ optional :participant_identity, :string, 4
15
+ optional :participant_name, :string, 5
16
+ optional :audio, :message, 6, "livekit.IngressAudioOptions"
17
+ optional :video, :message, 7, "livekit.IngressVideoOptions"
18
+ end
19
+ add_message "livekit.IngressAudioOptions" do
20
+ optional :name, :string, 1
21
+ optional :source, :enum, 2, "livekit.TrackSource"
22
+ optional :mime_type, :string, 3
23
+ optional :bitrate, :uint32, 4
24
+ optional :disable_dtx, :bool, 5
25
+ optional :channels, :uint32, 6
26
+ end
27
+ add_message "livekit.IngressVideoOptions" do
28
+ optional :name, :string, 1
29
+ optional :source, :enum, 2, "livekit.TrackSource"
30
+ optional :mime_type, :string, 3
31
+ repeated :layers, :message, 4, "livekit.VideoLayer"
32
+ end
33
+ add_message "livekit.IngressInfo" do
34
+ optional :ingress_id, :string, 1
35
+ optional :name, :string, 2
36
+ optional :stream_key, :string, 3
37
+ optional :url, :string, 4
38
+ optional :input_type, :enum, 5, "livekit.IngressInput"
39
+ optional :audio, :message, 6, "livekit.IngressAudioOptions"
40
+ optional :video, :message, 7, "livekit.IngressVideoOptions"
41
+ optional :room_name, :string, 8
42
+ optional :participant_identity, :string, 9
43
+ optional :participant_name, :string, 10
44
+ optional :reusable, :bool, 11
45
+ optional :state, :message, 12, "livekit.IngressState"
46
+ end
47
+ add_message "livekit.IngressState" do
48
+ optional :status, :enum, 1, "livekit.IngressState.Status"
49
+ optional :error, :string, 2
50
+ optional :video, :message, 3, "livekit.InputVideoState"
51
+ optional :audio, :message, 4, "livekit.InputAudioState"
52
+ optional :room_id, :string, 5
53
+ optional :started_at, :int64, 7
54
+ repeated :tracks, :message, 6, "livekit.TrackInfo"
55
+ end
56
+ add_enum "livekit.IngressState.Status" do
57
+ value :ENDPOINT_INACTIVE, 0
58
+ value :ENDPOINT_BUFFERING, 1
59
+ value :ENDPOINT_PUBLISHING, 2
60
+ value :ENDPOINT_ERROR, 3
61
+ end
62
+ add_message "livekit.InputVideoState" do
63
+ optional :mime_type, :uint32, 1
64
+ optional :width, :uint32, 3
65
+ optional :height, :uint32, 4
66
+ optional :framerate, :uint32, 5
67
+ end
68
+ add_message "livekit.InputAudioState" do
69
+ optional :mime_type, :uint32, 1
70
+ optional :channels, :uint32, 3
71
+ optional :sample_rate, :uint32, 4
72
+ end
73
+ add_message "livekit.UpdateIngressRequest" do
74
+ optional :ingress_id, :string, 1
75
+ optional :name, :string, 2
76
+ optional :room_name, :string, 3
77
+ optional :participant_identity, :string, 4
78
+ optional :participant_name, :string, 5
79
+ optional :audio, :message, 6, "livekit.IngressAudioOptions"
80
+ optional :video, :message, 7, "livekit.IngressVideoOptions"
81
+ end
82
+ add_message "livekit.ListIngressRequest" do
83
+ optional :room_name, :string, 1
84
+ end
85
+ add_message "livekit.ListIngressResponse" do
86
+ repeated :items, :message, 1, "livekit.IngressInfo"
87
+ end
88
+ add_message "livekit.DeleteIngressRequest" do
89
+ optional :ingress_id, :string, 1
90
+ end
91
+ add_enum "livekit.IngressInput" do
92
+ value :RTMP_INPUT, 0
93
+ end
94
+ end
95
+ end
96
+
97
+ module LiveKit
98
+ module Proto
99
+ CreateIngressRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.CreateIngressRequest").msgclass
100
+ IngressAudioOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.IngressAudioOptions").msgclass
101
+ IngressVideoOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.IngressVideoOptions").msgclass
102
+ IngressInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.IngressInfo").msgclass
103
+ IngressState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.IngressState").msgclass
104
+ IngressState::Status = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.IngressState.Status").enummodule
105
+ InputVideoState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.InputVideoState").msgclass
106
+ InputAudioState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.InputAudioState").msgclass
107
+ UpdateIngressRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.UpdateIngressRequest").msgclass
108
+ ListIngressRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ListIngressRequest").msgclass
109
+ ListIngressResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ListIngressResponse").msgclass
110
+ DeleteIngressRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.DeleteIngressRequest").msgclass
111
+ IngressInput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.IngressInput").enummodule
112
+ end
113
+ end
@@ -0,0 +1,20 @@
1
+ # Code generated by protoc-gen-twirp_ruby 1.9.0, DO NOT EDIT.
2
+ require 'twirp'
3
+ require_relative 'livekit_ingress_pb.rb'
4
+
5
+ module LiveKit
6
+ module Proto
7
+ class IngressService < Twirp::Service
8
+ package 'livekit'
9
+ service 'Ingress'
10
+ rpc :CreateIngress, CreateIngressRequest, IngressInfo, :ruby_method => :create_ingress
11
+ rpc :UpdateIngress, UpdateIngressRequest, IngressInfo, :ruby_method => :update_ingress
12
+ rpc :ListIngress, ListIngressRequest, ListIngressResponse, :ruby_method => :list_ingress
13
+ rpc :DeleteIngress, DeleteIngressRequest, IngressInfo, :ruby_method => :delete_ingress
14
+ end
15
+
16
+ class IngressClient < Twirp::Client
17
+ client_for IngressService
18
+ end
19
+ end
20
+ end
@@ -69,6 +69,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
69
69
  optional :mime_type, :string, 11
70
70
  optional :mid, :string, 12
71
71
  repeated :codecs, :message, 13, "livekit.SimulcastCodecInfo"
72
+ optional :stereo, :bool, 14
73
+ optional :disable_red, :bool, 15
72
74
  end
73
75
  add_message "livekit.VideoLayer" do
74
76
  optional :quality, :enum, 1, "livekit.VideoQuality"
@@ -105,6 +107,18 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
105
107
  optional :participant_sid, :string, 1
106
108
  repeated :track_sids, :string, 2
107
109
  end
110
+ add_message "livekit.ServerInfo" do
111
+ optional :edition, :enum, 1, "livekit.ServerInfo.Edition"
112
+ optional :version, :string, 2
113
+ optional :protocol, :int32, 3
114
+ optional :region, :string, 4
115
+ optional :node_id, :string, 5
116
+ optional :debug_info, :string, 6
117
+ end
118
+ add_enum "livekit.ServerInfo.Edition" do
119
+ value :Standard, 0
120
+ value :Cloud, 1
121
+ end
108
122
  add_message "livekit.ClientInfo" do
109
123
  optional :sdk, :enum, 1, "livekit.ClientInfo.SDK"
110
124
  optional :version, :string, 2
@@ -115,6 +129,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
115
129
  optional :browser, :string, 7
116
130
  optional :browser_version, :string, 8
117
131
  optional :address, :string, 9
132
+ optional :network, :string, 10
118
133
  end
119
134
  add_enum "livekit.ClientInfo.SDK" do
120
135
  value :UNKNOWN, 0
@@ -130,6 +145,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
130
145
  optional :screen, :message, 2, "livekit.VideoConfiguration"
131
146
  optional :resume_connection, :enum, 3, "livekit.ClientConfigSetting"
132
147
  optional :disabled_codecs, :message, 4, "livekit.DisabledCodecs"
148
+ optional :force_relay, :enum, 5, "livekit.ClientConfigSetting"
133
149
  end
134
150
  add_message "livekit.VideoConfiguration" do
135
151
  optional :hardware_encoder, :enum, 1, "livekit.ClientConfigSetting"
@@ -144,6 +160,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
144
160
  optional :packets, :uint32, 4
145
161
  optional :packet_rate, :double, 5
146
162
  optional :bytes, :uint64, 6
163
+ optional :header_bytes, :uint64, 39
147
164
  optional :bitrate, :double, 7
148
165
  optional :packets_lost, :uint32, 8
149
166
  optional :packet_loss_rate, :double, 9
@@ -151,10 +168,12 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
151
168
  optional :packets_duplicate, :uint32, 11
152
169
  optional :packet_duplicate_rate, :double, 12
153
170
  optional :bytes_duplicate, :uint64, 13
171
+ optional :header_bytes_duplicate, :uint64, 40
154
172
  optional :bitrate_duplicate, :double, 14
155
173
  optional :packets_padding, :uint32, 15
156
174
  optional :packet_padding_rate, :double, 16
157
175
  optional :bytes_padding, :uint64, 17
176
+ optional :header_bytes_padding, :uint64, 41
158
177
  optional :bitrate_padding, :double, 18
159
178
  optional :packets_out_of_order, :uint32, 19
160
179
  optional :frames, :uint32, 20
@@ -177,6 +196,10 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
177
196
  optional :layer_lock_plis, :uint32, 35
178
197
  optional :last_layer_lock_pli, :message, 36, "google.protobuf.Timestamp"
179
198
  end
199
+ add_message "livekit.TimedVersion" do
200
+ optional :unix_micro, :int64, 1
201
+ optional :ticks, :int32, 2
202
+ end
180
203
  add_enum "livekit.TrackType" do
181
204
  value :AUDIO, 0
182
205
  value :VIDEO, 1
@@ -205,6 +228,16 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
205
228
  value :DISABLED, 1
206
229
  value :ENABLED, 2
207
230
  end
231
+ add_enum "livekit.DisconnectReason" do
232
+ value :UNKNOWN_REASON, 0
233
+ value :CLIENT_INITIATED, 1
234
+ value :DUPLICATE_IDENTITY, 2
235
+ value :SERVER_SHUTDOWN, 3
236
+ value :PARTICIPANT_REMOVED, 4
237
+ value :ROOM_DELETED, 5
238
+ value :STATE_MISMATCH, 6
239
+ value :JOIN_FAILURE, 7
240
+ end
208
241
  end
209
242
  end
210
243
 
@@ -224,16 +257,20 @@ module LiveKit
224
257
  SpeakerInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.SpeakerInfo").msgclass
225
258
  UserPacket = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.UserPacket").msgclass
226
259
  ParticipantTracks = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ParticipantTracks").msgclass
260
+ ServerInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ServerInfo").msgclass
261
+ ServerInfo::Edition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ServerInfo.Edition").enummodule
227
262
  ClientInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ClientInfo").msgclass
228
263
  ClientInfo::SDK = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ClientInfo.SDK").enummodule
229
264
  ClientConfiguration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ClientConfiguration").msgclass
230
265
  VideoConfiguration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.VideoConfiguration").msgclass
231
266
  DisabledCodecs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.DisabledCodecs").msgclass
232
267
  RTPStats = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.RTPStats").msgclass
268
+ TimedVersion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.TimedVersion").msgclass
233
269
  TrackType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.TrackType").enummodule
234
270
  TrackSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.TrackSource").enummodule
235
271
  VideoQuality = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.VideoQuality").enummodule
236
272
  ConnectionQuality = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ConnectionQuality").enummodule
237
273
  ClientConfigSetting = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ClientConfigSetting").enummodule
274
+ DisconnectReason = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.DisconnectReason").enummodule
238
275
  end
239
276
  end
@@ -4,6 +4,7 @@
4
4
  require 'google/protobuf'
5
5
 
6
6
  require 'livekit_models_pb'
7
+ require 'livekit_egress_pb'
7
8
 
8
9
  Google::Protobuf::DescriptorPool.generated_pool.build do
9
10
  add_file("livekit_room.proto", :syntax => :proto3) do
@@ -13,6 +14,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
13
14
  optional :max_participants, :uint32, 3
14
15
  optional :node_id, :string, 4
15
16
  optional :metadata, :string, 5
17
+ optional :egress, :message, 6, "livekit.RoomEgress"
18
+ end
19
+ add_message "livekit.RoomEgress" do
20
+ optional :room, :message, 1, "livekit.RoomCompositeEgressRequest"
21
+ optional :tracks, :message, 2, "livekit.AutoTrackEgress"
16
22
  end
17
23
  add_message "livekit.ListRoomsRequest" do
18
24
  repeated :names, :string, 1
@@ -51,6 +57,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
51
57
  optional :identity, :string, 2
52
58
  optional :metadata, :string, 3
53
59
  optional :permission, :message, 4, "livekit.ParticipantPermission"
60
+ optional :name, :string, 5
54
61
  end
55
62
  add_message "livekit.UpdateSubscriptionsRequest" do
56
63
  optional :room, :string, 1
@@ -79,6 +86,7 @@ end
79
86
  module LiveKit
80
87
  module Proto
81
88
  CreateRoomRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.CreateRoomRequest").msgclass
89
+ RoomEgress = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.RoomEgress").msgclass
82
90
  ListRoomsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ListRoomsRequest").msgclass
83
91
  ListRoomsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ListRoomsResponse").msgclass
84
92
  DeleteRoomRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.DeleteRoomRequest").msgclass
@@ -5,7 +5,7 @@ require 'google/protobuf'
5
5
 
6
6
  require 'livekit_models_pb'
7
7
  require 'livekit_egress_pb'
8
- require 'livekit_recording_pb'
8
+ require 'livekit_ingress_pb'
9
9
 
10
10
  Google::Protobuf::DescriptorPool.generated_pool.build do
11
11
  add_file("livekit_webhook.proto", :syntax => :proto3) do
@@ -13,8 +13,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
13
13
  optional :event, :string, 1
14
14
  optional :room, :message, 2, "livekit.Room"
15
15
  optional :participant, :message, 3, "livekit.ParticipantInfo"
16
- optional :recording_info, :message, 5, "livekit.RecordingInfo"
17
16
  optional :egress_info, :message, 9, "livekit.EgressInfo"
17
+ optional :ingress_info, :message, 10, "livekit.IngressInfo"
18
18
  optional :track, :message, 8, "livekit.TrackInfo"
19
19
  optional :id, :string, 6
20
20
  optional :created_at, :int64, 7
@@ -13,10 +13,15 @@ module LiveKit
13
13
  @api_secret = api_secret
14
14
  end
15
15
 
16
- def create_room(name, empty_timeout: nil, max_participants: nil)
16
+ def create_room(name, empty_timeout: nil, max_participants: nil, egress: nil)
17
17
  self.rpc(
18
18
  :CreateRoom,
19
- Proto::CreateRoomRequest.new(name: name, empty_timeout: empty_timeout, max_participants: max_participants),
19
+ Proto::CreateRoomRequest.new(
20
+ name: name,
21
+ empty_timeout: empty_timeout,
22
+ max_participants: max_participants,
23
+ egress: egress,
24
+ ),
20
25
  headers: auth_header(roomCreate: true),
21
26
  )
22
27
  end
@@ -82,7 +87,7 @@ module LiveKit
82
87
  )
83
88
  end
84
89
 
85
- def update_participant(room:, identity:, metadata: nil, permission: nil)
90
+ def update_participant(room:, identity:, metadata: nil, permission: nil, name: nil)
86
91
  req = Proto::UpdateParticipantRequest.new(room: room, identity: identity)
87
92
  if metadata
88
93
  req.metadata = metadata
@@ -90,6 +95,9 @@ module LiveKit
90
95
  if permission
91
96
  req.permission = permission
92
97
  end
98
+ if name
99
+ req.name = name
100
+ end
93
101
  self.rpc(
94
102
  :UpdateParticipant,
95
103
  req,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LiveKit
4
- VERSION = "0.3.1"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/livekit.rb CHANGED
@@ -10,3 +10,4 @@ require "livekit/version"
10
10
  $LOAD_PATH.unshift(File.expand_path("livekit/proto", __dir__))
11
11
  require "livekit/room_service_client"
12
12
  require "livekit/egress_service_client"
13
+ require "livekit/ingress_service_client"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livekit-server-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omri Gabay
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-06-13 00:00:00.000000000 Z
12
+ date: 2022-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-protobuf
@@ -98,8 +98,11 @@ files:
98
98
  - lib/livekit/egress_service_client.rb
99
99
  - lib/livekit/egress_types.rb
100
100
  - lib/livekit/grants.rb
101
+ - lib/livekit/ingress_service_client.rb
101
102
  - lib/livekit/proto/livekit_egress_pb.rb
102
103
  - lib/livekit/proto/livekit_egress_twirp.rb
104
+ - lib/livekit/proto/livekit_ingress_pb.rb
105
+ - lib/livekit/proto/livekit_ingress_twirp.rb
103
106
  - lib/livekit/proto/livekit_models_pb.rb
104
107
  - lib/livekit/proto/livekit_models_twirp.rb
105
108
  - lib/livekit/proto/livekit_room_pb.rb
@@ -130,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
133
  - !ruby/object:Gem::Version
131
134
  version: '0'
132
135
  requirements: []
133
- rubygems_version: 3.3.11
136
+ rubygems_version: 3.3.7
134
137
  signing_key:
135
138
  specification_version: 4
136
139
  summary: LiveKit Server SDK for Ruby