Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 4.13.0

* Updating the `Archives#create` method to allow `quantization_parameter` as an option, and the `WebSocket#connect` method to allow `bidirectional` as an option. See [#290](https://github.com/opentok/OpenTok-Ruby-SDK/pull/290)

# 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)
Expand Down
8 changes: 7 additions & 1 deletion lib/opentok/archives.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ def initialize(client)
# 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.
#
# @option options [Integer] :quantization_parameter (Optional) The quantization parameter (QP) is an optional video encoding value allowed for composed archiving,
# smaller values generate higher quality and larger archives, larger values generate lower quality and smaller archives, QP uses variable bitrate (VBR). The minimum
# value is 15 and the maximum is 40.
# This parameter is mutually exclusive with the max_bitrate parameter.
#
# @return [Archive] The Archive object, which includes properties defining the archive,
# including the archive ID.
#
Expand All @@ -110,7 +115,8 @@ def create(session_id, options = {})
:layout,
:multi_archive_tag,
:stream_mode,
:max_bitrate
:max_bitrate,
:quantization_parameter
]
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.12.0'
VERSION = '4.13.0'
end
1 change: 1 addition & 0 deletions lib/opentok/websocket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class WebSocket
# If you omit this property, all streams in the session will be included.
# @option opts [Hash] :headers (optional) A hash of key-value pairs of headers to be sent to your WebSocket server with each message,
# with a maximum length of 512 bytes.
# @option opts [Boolean] :bidirectional (optional) Whether the WebSocket connection should be bidirectional.
def connect(session_id, token, websocket_uri, opts = {})
response = @client.connect_websocket(session_id, token, websocket_uri, opts)
end
Expand Down

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

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 @@ -77,6 +77,13 @@
expect(archive.max_bitrate).to eq max_bitrate
end

it "should create an archive with quantizationParameter set to specified quantization_parameter value", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
quantization_parameter = 40
archive = archives.create session_id, :quantization_parameter => quantization_parameter
expect(archive).to be_an_instance_of OpenTok::Archive
expect(archive.quantization_parameter).to eq quantization_parameter
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
11 changes: 11 additions & 0 deletions spec/opentok/websocket_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,15 @@
response = websocket.connect(session_id, expiring_token, websocket_uri)
expect(response).not_to be_nil
end

it "receives a valid response with opts", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
opts = {
"streams" => ["123456"],
"headers" => {"foo" => "bar"},
"bidirectional" => true
}

response = websocket.connect(session_id, expiring_token, websocket_uri, opts)
expect(response).not_to be_nil
end
end