Skip to content

Commit

Permalink
DEVX-9004: Implementing max bitrate for archives (#288)
Browse files Browse the repository at this point in the history
* Implementing max bitrate for archives
  • Loading branch information
superchilled authored Feb 7, 2025
1 parent b6d4bc6 commit 6e6478c
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 4.12.0

* Updating the `Archives#create` method to allow `max_bitrate` as an option. See [#288](https://github.com/opentok/OpenTok-Ruby-SDK/pull/288)

# 4.11.0

* Updating client token creation to use JWTs by default. See [#287](https://github.com/opentok/OpenTok-Ruby-SDK/pull/274)
Expand Down
7 changes: 6 additions & 1 deletion lib/opentok/archives.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ def initialize(client)
# layout type. For more information, see
# {https://tokbox.com/developer/guides/archiving/layout-control.html Customizing
# the video layout for composed archives}.
# @option options [Integer] :max_bitrate (Optional) The maximum video bitrate for the archive, in bits per second. The minimum
# value is 100,000 and the maximum is 6,000,000. This option is only valid for composed archives. Set the maximum video bitrate
# to control the size of the composed archive. This maximum bitrate applies to the video bitrate only. If the output archive has
# audio, those bits will be excluded from the limit.
#
# @return [Archive] The Archive object, which includes properties defining the archive,
# including the archive ID.
Expand All @@ -105,7 +109,8 @@ def create(session_id, options = {})
:resolution,
:layout,
:multi_archive_tag,
:stream_mode
:stream_mode,
:max_bitrate
]
opts = options.inject({}) do |m,(k,v)|
if valid_opts.include? k.to_sym
Expand Down
2 changes: 1 addition & 1 deletion lib/opentok/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module OpenTok
# @private
VERSION = '4.11.0'
VERSION = '4.12.0'
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions spec/opentok/archives_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@
expect(archive.stream_mode).to eq stream_mode
end

it "should create an archive with maxBitrate set to specified max_bitrate value", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
max_bitrate = 200000
archive = archives.create session_id, :max_bitrate => max_bitrate
expect(archive).to be_an_instance_of OpenTok::Archive
expect(archive.max_bitrate).to eq max_bitrate
end

it "should create audio only archives", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
archive = archives.create session_id, :has_video => false
expect(archive).to be_an_instance_of OpenTok::Archive
Expand Down

0 comments on commit 6e6478c

Please sign in to comment.