livekit-server-sdk 0.2.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.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +12 -0
  3. data/.github/workflows/test.yml +25 -0
  4. data/.gitignore +12 -0
  5. data/.gitmodules +3 -0
  6. data/.rspec +3 -0
  7. data/.rubocop.yml +16 -0
  8. data/.rubocop_todo.yml +22 -0
  9. data/.ruby-version +1 -0
  10. data/.tool-versions +3 -0
  11. data/CHANGELOG.md +5 -0
  12. data/CODE_OF_CONDUCT.md +84 -0
  13. data/Gemfile +17 -0
  14. data/Gemfile.lock +103 -0
  15. data/LICENSE.txt +21 -0
  16. data/README.md +45 -0
  17. data/Rakefile +19 -0
  18. data/bin/bootstrap.sh +5 -0
  19. data/bin/bundle +114 -0
  20. data/bin/coderay +29 -0
  21. data/bin/console +8 -0
  22. data/bin/htmldiff +29 -0
  23. data/bin/ldiff +29 -0
  24. data/bin/pry +29 -0
  25. data/bin/rake +29 -0
  26. data/bin/rspec +29 -0
  27. data/bin/rubocop +29 -0
  28. data/bin/ruby-parse +29 -0
  29. data/bin/ruby-rewrite +29 -0
  30. data/bin/yard +29 -0
  31. data/bin/yardoc +29 -0
  32. data/bin/yri +29 -0
  33. data/lib/livekit/access_token.rb +66 -0
  34. data/lib/livekit/auth_mixin.rb +12 -0
  35. data/lib/livekit/grants.rb +107 -0
  36. data/lib/livekit/proto/livekit_models_pb.rb +133 -0
  37. data/lib/livekit/proto/livekit_models_twirp.rb +8 -0
  38. data/lib/livekit/proto/livekit_recording_pb.rb +95 -0
  39. data/lib/livekit/proto/livekit_recording_twirp.rb +20 -0
  40. data/lib/livekit/proto/livekit_room_pb.rb +105 -0
  41. data/lib/livekit/proto/livekit_room_twirp.rb +27 -0
  42. data/lib/livekit/proto/livekit_webhook_pb.rb +26 -0
  43. data/lib/livekit/proto/livekit_webhook_twirp.rb +8 -0
  44. data/lib/livekit/room_service_client.rb +128 -0
  45. data/lib/livekit/token_verifier.rb +21 -0
  46. data/lib/livekit/utils.rb +29 -0
  47. data/lib/livekit/version.rb +5 -0
  48. data/lib/livekit.rb +12 -0
  49. data/livekit_server_sdk.gemspec +35 -0
  50. metadata +135 -0
data/bin/rake ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
data/bin/rubocop ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rubocop", "rubocop")
data/bin/ruby-parse ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'ruby-parse' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("parser", "ruby-parse")
data/bin/ruby-rewrite ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'ruby-rewrite' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("parser", "ruby-rewrite")
data/bin/yard ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'yard' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("yard", "yard")
data/bin/yardoc ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'yardoc' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("yard", "yardoc")
data/bin/yri ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'yri' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("yard", "yri")
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jwt"
4
+
5
+ module LiveKit
6
+ class AccessToken
7
+ # 6 hours in seconds; how long the access token to the server is good for
8
+ DEFAULT_TTL = 14_400
9
+
10
+ # The signing algorithm used by the {jwt} gem internals
11
+ SIGNING_ALGORITHM = "HS256"
12
+
13
+ attr_accessor :grants, :identity
14
+
15
+ def initialize(api_key: nil, api_secret: nil, identity: nil, ttl: DEFAULT_TTL, name: nil, metadata: nil)
16
+ @api_key = api_key || ENV["LIVEKIT_API_KEY"]
17
+ @api_secret = api_secret || ENV["LIVEKIT_API_SECRET"]
18
+ @grants = ClaimGrant.new
19
+ @grants.name = name
20
+ @grants.metadata = metadata
21
+ @identity = identity
22
+ @ttl = ttl
23
+ end
24
+
25
+ def add_grant(video_grant)
26
+ if video_grant.is_a?(Hash)
27
+ video_grant = VideoGrant.from_hash(video_grant)
28
+ end
29
+ @grants.video = video_grant
30
+ end
31
+
32
+ def metadata=(participant_md)
33
+ @grants.metadata = participant_md
34
+ end
35
+
36
+ def name=(participant_name)
37
+ @grants.name = participant_name
38
+ end
39
+
40
+ def sha256
41
+ @grants.sha256
42
+ end
43
+
44
+ def sha256=(sha_string)
45
+ @grants.sha256 = sha_string
46
+ end
47
+
48
+ def to_jwt
49
+ if @grants.video.nil?
50
+ raise ArgumentError, "VideoGrant is required"
51
+ end
52
+
53
+ jwt_timestamp = Time.now.to_i
54
+ payload = {}
55
+ payload.merge!(@grants.to_hash)
56
+ payload.merge!({
57
+ exp: jwt_timestamp + @ttl,
58
+ nbf: jwt_timestamp - 5,
59
+ iss: @api_key,
60
+ sub: @identity,
61
+ })
62
+
63
+ return JWT.encode(payload, @api_secret, SIGNING_ALGORITHM)
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,12 @@
1
+ module LiveKit
2
+ # Create authenticated headers when keys are provided
3
+ module AuthMixin
4
+ def auth_header(video_grant)
5
+ headers = {}
6
+ t = ::LiveKit::AccessToken.new(api_key: @api_key, api_secret: @api_secret)
7
+ t.add_grant(video_grant)
8
+ headers["Authorization"] = "Bearer #{t.to_jwt}"
9
+ headers
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,107 @@
1
+ module LiveKit
2
+ class ClaimGrant
3
+ attr_accessor :identity, :name, :metadata, :sha256, :video
4
+
5
+ def self.from_hash(hash)
6
+ return nil if hash.nil?
7
+
8
+ claim_grant = ClaimGrant.new
9
+ claim_grant.identity = hash["sub"]
10
+ claim_grant.name = hash["name"]
11
+ claim_grant.metadata = hash["metadata"]
12
+ claim_grant.sha256 = hash["sha256"]
13
+ claim_grant.video = VideoGrant.from_hash(hash["video"])
14
+ return claim_grant
15
+ end
16
+
17
+ def initialize
18
+ @identity = nil
19
+ @name = nil
20
+ @metadata = nil
21
+ @sha256 = nil
22
+ @video = nil
23
+ end
24
+
25
+ def to_hash
26
+ {
27
+ name: @name,
28
+ metadata: @metadata,
29
+ sha256: @sha256,
30
+ video: @video.to_hash,
31
+ }
32
+ end
33
+ end
34
+
35
+ class VideoGrant
36
+ attr_accessor :roomCreate, :roomJoin, :roomList, :roomRecord, :roomAdmin,
37
+ :room, :canPublish, :canSubscribe, :canPublishData, :hidden, :recorder
38
+
39
+ def initialize(
40
+ # true if can create or delete rooms
41
+ roomCreate: nil,
42
+ # true if can join room
43
+ roomJoin: nil,
44
+ # true if can list rooms
45
+ roomList: nil,
46
+ # true if can record
47
+ roomRecord: nil,
48
+ # true if can manage the room
49
+ roomAdmin: nil,
50
+ # name of the room for join or admin permissions
51
+ room: nil,
52
+ # for join tokens, can participant publish, true by default
53
+ canPublish: nil,
54
+ # for join tokens, can participant subscribe, true by default
55
+ canSubscribe: nil,
56
+ # for join tokens, can participant publish data messages, true by default
57
+ canPublishData: nil,
58
+ # if participant should remain invisible to others
59
+ hidden: nil,
60
+ # if participant is recording the room
61
+ recorder: nil
62
+ )
63
+ @roomCreate = roomCreate
64
+ @roomJoin = roomJoin
65
+ @roomList = roomList
66
+ @roomRecord = roomRecord
67
+ @roomAdmin = roomAdmin
68
+ @room = room
69
+ @canPublish = canPublish
70
+ @canSubscribe = canSubscribe
71
+ @canPublishData = canPublishData
72
+ @hidden = hidden
73
+ @recorder = recorder
74
+ end
75
+
76
+ def self.from_hash(hash)
77
+ return nil if hash.nil?
78
+
79
+ hash = hash.stringify_keys
80
+
81
+ VideoGrant.new(
82
+ roomCreate: hash["roomCreate"],
83
+ roomJoin: hash["roomJoin"],
84
+ roomList: hash["roomList"],
85
+ roomRecord: hash["roomRecord"],
86
+ roomAdmin: hash["roomAdmin"],
87
+ room: hash["room"],
88
+ canPublish: hash["canPublish"],
89
+ canSubscribe: hash["canSubscribe"],
90
+ canPublishData: hash["canPublishData"],
91
+ hidden: hash["hidden"],
92
+ recorder: hash["recorder"],
93
+ )
94
+ end
95
+
96
+ def to_hash
97
+ hash = {}
98
+ instance_variables.each { |var|
99
+ val = instance_variable_get(var)
100
+ if val != nil
101
+ hash[var.to_s.delete("@")] = val
102
+ end
103
+ }
104
+ hash
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,133 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: livekit_models.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_file("livekit_models.proto", :syntax => :proto3) do
8
+ add_message "livekit.Room" do
9
+ optional :sid, :string, 1
10
+ optional :name, :string, 2
11
+ optional :empty_timeout, :uint32, 3
12
+ optional :max_participants, :uint32, 4
13
+ optional :creation_time, :int64, 5
14
+ optional :turn_password, :string, 6
15
+ repeated :enabled_codecs, :message, 7, "livekit.Codec"
16
+ optional :metadata, :string, 8
17
+ optional :num_participants, :uint32, 9
18
+ optional :active_recording, :bool, 10
19
+ end
20
+ add_message "livekit.Codec" do
21
+ optional :mime, :string, 1
22
+ optional :fmtp_line, :string, 2
23
+ end
24
+ add_message "livekit.ParticipantInfo" do
25
+ optional :sid, :string, 1
26
+ optional :identity, :string, 2
27
+ optional :state, :enum, 3, "livekit.ParticipantInfo.State"
28
+ repeated :tracks, :message, 4, "livekit.TrackInfo"
29
+ optional :metadata, :string, 5
30
+ optional :joined_at, :int64, 6
31
+ optional :hidden, :bool, 7
32
+ optional :recorder, :bool, 8
33
+ optional :name, :string, 9
34
+ end
35
+ add_enum "livekit.ParticipantInfo.State" do
36
+ value :JOINING, 0
37
+ value :JOINED, 1
38
+ value :ACTIVE, 2
39
+ value :DISCONNECTED, 3
40
+ end
41
+ add_message "livekit.TrackInfo" do
42
+ optional :sid, :string, 1
43
+ optional :type, :enum, 2, "livekit.TrackType"
44
+ optional :name, :string, 3
45
+ optional :muted, :bool, 4
46
+ optional :width, :uint32, 5
47
+ optional :height, :uint32, 6
48
+ optional :simulcast, :bool, 7
49
+ optional :disable_dtx, :bool, 8
50
+ optional :source, :enum, 9, "livekit.TrackSource"
51
+ repeated :layers, :message, 10, "livekit.VideoLayer"
52
+ optional :mime_type, :string, 11
53
+ end
54
+ add_message "livekit.VideoLayer" do
55
+ optional :quality, :enum, 1, "livekit.VideoQuality"
56
+ optional :width, :uint32, 2
57
+ optional :height, :uint32, 3
58
+ optional :bitrate, :uint32, 4
59
+ end
60
+ add_message "livekit.DataPacket" do
61
+ optional :kind, :enum, 1, "livekit.DataPacket.Kind"
62
+ oneof :value do
63
+ optional :user, :message, 2, "livekit.UserPacket"
64
+ optional :speaker, :message, 3, "livekit.ActiveSpeakerUpdate"
65
+ end
66
+ end
67
+ add_enum "livekit.DataPacket.Kind" do
68
+ value :RELIABLE, 0
69
+ value :LOSSY, 1
70
+ end
71
+ add_message "livekit.ActiveSpeakerUpdate" do
72
+ repeated :speakers, :message, 1, "livekit.SpeakerInfo"
73
+ end
74
+ add_message "livekit.SpeakerInfo" do
75
+ optional :sid, :string, 1
76
+ optional :level, :float, 2
77
+ optional :active, :bool, 3
78
+ end
79
+ add_message "livekit.UserPacket" do
80
+ optional :participant_sid, :string, 1
81
+ optional :payload, :bytes, 2
82
+ repeated :destination_sids, :string, 3
83
+ end
84
+ add_message "livekit.ParticipantTracks" do
85
+ optional :participant_sid, :string, 1
86
+ repeated :track_sids, :string, 2
87
+ end
88
+ add_enum "livekit.TrackType" do
89
+ value :AUDIO, 0
90
+ value :VIDEO, 1
91
+ value :DATA, 2
92
+ end
93
+ add_enum "livekit.TrackSource" do
94
+ value :UNKNOWN, 0
95
+ value :CAMERA, 1
96
+ value :MICROPHONE, 2
97
+ value :SCREEN_SHARE, 3
98
+ value :SCREEN_SHARE_AUDIO, 4
99
+ end
100
+ add_enum "livekit.VideoQuality" do
101
+ value :LOW, 0
102
+ value :MEDIUM, 1
103
+ value :HIGH, 2
104
+ value :OFF, 3
105
+ end
106
+ add_enum "livekit.ConnectionQuality" do
107
+ value :POOR, 0
108
+ value :GOOD, 1
109
+ value :EXCELLENT, 2
110
+ end
111
+ end
112
+ end
113
+
114
+ module LiveKit
115
+ module Proto
116
+ Room = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.Room").msgclass
117
+ Codec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.Codec").msgclass
118
+ ParticipantInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ParticipantInfo").msgclass
119
+ ParticipantInfo::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ParticipantInfo.State").enummodule
120
+ TrackInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.TrackInfo").msgclass
121
+ VideoLayer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.VideoLayer").msgclass
122
+ DataPacket = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.DataPacket").msgclass
123
+ DataPacket::Kind = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.DataPacket.Kind").enummodule
124
+ ActiveSpeakerUpdate = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ActiveSpeakerUpdate").msgclass
125
+ SpeakerInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.SpeakerInfo").msgclass
126
+ UserPacket = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.UserPacket").msgclass
127
+ ParticipantTracks = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ParticipantTracks").msgclass
128
+ TrackType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.TrackType").enummodule
129
+ TrackSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.TrackSource").enummodule
130
+ VideoQuality = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.VideoQuality").enummodule
131
+ ConnectionQuality = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.ConnectionQuality").enummodule
132
+ end
133
+ end
@@ -0,0 +1,8 @@
1
+ # Code generated by protoc-gen-twirp_ruby 1.9.0, DO NOT EDIT.
2
+ require 'twirp'
3
+ require_relative 'livekit_models_pb.rb'
4
+
5
+ module LiveKit
6
+ module Proto
7
+ end
8
+ end
@@ -0,0 +1,95 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: livekit_recording.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/protobuf/empty_pb'
7
+
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ add_file("livekit_recording.proto", :syntax => :proto3) do
10
+ add_message "livekit.StartRecordingRequest" do
11
+ optional :options, :message, 5, "livekit.RecordingOptions"
12
+ oneof :input do
13
+ optional :url, :string, 1
14
+ optional :template, :message, 2, "livekit.RecordingTemplate"
15
+ end
16
+ oneof :output do
17
+ optional :rtmp, :message, 3, "livekit.RtmpOutput"
18
+ optional :filepath, :string, 4
19
+ end
20
+ end
21
+ add_message "livekit.RecordingTemplate" do
22
+ optional :layout, :string, 1
23
+ optional :room_name, :string, 2
24
+ optional :base_url, :string, 3
25
+ end
26
+ add_message "livekit.RtmpOutput" do
27
+ repeated :urls, :string, 1
28
+ end
29
+ add_message "livekit.RecordingOptions" do
30
+ optional :preset, :enum, 1, "livekit.RecordingPreset"
31
+ optional :width, :int32, 2
32
+ optional :height, :int32, 3
33
+ optional :depth, :int32, 4
34
+ optional :framerate, :int32, 5
35
+ optional :audio_bitrate, :int32, 6
36
+ optional :audio_frequency, :int32, 7
37
+ optional :video_bitrate, :int32, 8
38
+ optional :profile, :string, 9
39
+ end
40
+ add_message "livekit.StartRecordingResponse" do
41
+ optional :recording_id, :string, 1
42
+ end
43
+ add_message "livekit.AddOutputRequest" do
44
+ optional :recording_id, :string, 1
45
+ optional :rtmp_url, :string, 2
46
+ end
47
+ add_message "livekit.RemoveOutputRequest" do
48
+ optional :recording_id, :string, 1
49
+ optional :rtmp_url, :string, 2
50
+ end
51
+ add_message "livekit.EndRecordingRequest" do
52
+ optional :recording_id, :string, 1
53
+ end
54
+ add_message "livekit.RecordingInfo" do
55
+ optional :id, :string, 1
56
+ optional :room_name, :string, 2
57
+ optional :active, :bool, 3
58
+ optional :error, :string, 4
59
+ optional :file, :message, 5, "livekit.FileResult"
60
+ repeated :rtmp, :message, 6, "livekit.RtmpResult"
61
+ end
62
+ add_message "livekit.FileResult" do
63
+ optional :download_url, :string, 1
64
+ optional :duration, :int64, 2
65
+ end
66
+ add_message "livekit.RtmpResult" do
67
+ optional :stream_url, :string, 1
68
+ optional :duration, :int64, 2
69
+ end
70
+ add_enum "livekit.RecordingPreset" do
71
+ value :NONE, 0
72
+ value :HD_30, 1
73
+ value :HD_60, 2
74
+ value :FULL_HD_30, 3
75
+ value :FULL_HD_60, 4
76
+ end
77
+ end
78
+ end
79
+
80
+ module LiveKit
81
+ module Proto
82
+ StartRecordingRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.StartRecordingRequest").msgclass
83
+ RecordingTemplate = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.RecordingTemplate").msgclass
84
+ RtmpOutput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.RtmpOutput").msgclass
85
+ RecordingOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.RecordingOptions").msgclass
86
+ StartRecordingResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.StartRecordingResponse").msgclass
87
+ AddOutputRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.AddOutputRequest").msgclass
88
+ RemoveOutputRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.RemoveOutputRequest").msgclass
89
+ EndRecordingRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.EndRecordingRequest").msgclass
90
+ RecordingInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.RecordingInfo").msgclass
91
+ FileResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.FileResult").msgclass
92
+ RtmpResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.RtmpResult").msgclass
93
+ RecordingPreset = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("livekit.RecordingPreset").enummodule
94
+ end
95
+ 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_recording_pb.rb'
4
+
5
+ module LiveKit
6
+ module Proto
7
+ class RecordingServiceService < Twirp::Service
8
+ package 'livekit'
9
+ service 'RecordingService'
10
+ rpc :StartRecording, StartRecordingRequest, StartRecordingResponse, :ruby_method => :start_recording
11
+ rpc :AddOutput, AddOutputRequest, Google::Protobuf::Empty, :ruby_method => :add_output
12
+ rpc :RemoveOutput, RemoveOutputRequest, Google::Protobuf::Empty, :ruby_method => :remove_output
13
+ rpc :EndRecording, EndRecordingRequest, Google::Protobuf::Empty, :ruby_method => :end_recording
14
+ end
15
+
16
+ class RecordingServiceClient < Twirp::Client
17
+ client_for RecordingServiceService
18
+ end
19
+ end
20
+ end