Skip to content

Commit

Permalink
Merge pull request #240 from opentok/dev
Browse files Browse the repository at this point in the history
Version 4.3.0
  • Loading branch information
superchilled authored Feb 1, 2022
2 parents 142ef84 + d75187c commit ed1908e
Show file tree
Hide file tree
Showing 41 changed files with 2,000 additions and 38 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ master ]
branches: [ main, dev, beta ]
pull_request:
branches: [ master ]
branches: [ main, dev, beta ]

jobs:
test:
Expand All @@ -27,4 +27,4 @@ jobs:
- name: Run tests
run: bundle exec rake spec
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
153 changes: 153 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# 4.3.0

* Fixes an issue with `activesupport` [#238](https://github.com/opentok/OpenTok-Ruby-SDK/pull/238)
* Adds Force Mute feature [#233](https://github.com/opentok/OpenTok-Ruby-SDK/pull/233) and [#237](https://github.com/opentok/OpenTok-Ruby-SDK/pull/237)
* Adds Listing Live Streaming Broadcasts feature [#236](https://github.com/opentok/OpenTok-Ruby-SDK/pull/236). Thanks [@ihors-livestorm](https://github.com/ihors-livestorm)!
* Adds Selective Stream feature [#235](https://github.com/opentok/OpenTok-Ruby-SDK/pull/235)
* Adds Dial DTMF feature [#234](https://github.com/opentok/OpenTok-Ruby-SDK/pull/234)
* Adds Observe Force Mute flag to `Sip#dial` method [#232](https://github.com/opentok/OpenTok-Ruby-SDK/pull/232)
* Updates dependency version (`rake`) [#231](https://github.com/opentok/OpenTok-Ruby-SDK/pull/231)
* Adds Video Outbound flag to `Sip#dial` method [#227](https://github.com/opentok/OpenTok-Ruby-SDK/pull/227)

# 4.2.0

* A new `screenshare_type` parameter has been added to the layout options for archives and broadcasts, and this release makes it available in the SDK: https://tokbox.com/developer/rest/

# 4.1.2 Release

Fixes an issue with custom broadcast layout [#218](https://github.com/opentok/OpenTok-Ruby-SDK/pull/218)

# 4.1.1

Patch release to address issue corrected in [#214](https://github.com/opentok/OpenTok-Ruby-SDK/pull/214)

# Release v4.1.0

Add a `timeout_length` custom parameter that allows for the specification in seconds to wait before timing out for HTTP requests.

# Release 4.0.1

* Addresses an issue with invocation of `Set` in rubies v2.5
* Updates cassettes for request header changes in HTTParty

# Release 4.0.0

* Update gems (thanks [@fidalgo](https://github.com/fidalgo))
* Adds Ruby 2.7 support
* Removes Ruby 2.0 support. (For Ruby v2.0.0 please continue to use the OpenTok Ruby SDK v3.0.0.)
* Add layout to archive create (thanks [@mjthompsgb](https://github.com/mjthompsgb))
* Broadcast sample (thanks [@IGitGotIt](https://github.com/IGitGotIt))

# Release v3.1.0

Adds the following APIs (Thanks @JayTokBox & [@normanargueta](https://github.com/normanargueta)):
- Force Disconnect
- Signaling
- Resolution Support
- Archive Layouts
- Broadcasting APIs
- Get & List streams

Updates and improves documentation! (Thanks [@jeffswartz](https://github.com/jeffswartz) )

# Release v3.0.3

Fixes internal logging and useragent issue

# Release v3.0.1

Upgraded dependency version ([#155](https://github.com/opentok/OpenTok-Ruby-SDK/pull/155))

# Release v3.0.0

Updating the version of httparty to 0.15. This is a breaking change because we require Ruby >= 2.0.0 now.


# Release v2.5.0

This updates includes the following change:

- [Add a dial method to initiate a SIP call](https://github.com/opentok/OpenTok-Ruby-SDK/pull/133)

Thanks @herestomwiththeweather!

# Release v2.4.1

This updates includes the following changes:

- [Support for the initial_layout_class_list feature of tokens](https://github.com/opentok/OpenTok-Ruby-SDK/pull/146)
- [Remove unnecessary info param from JS samples](https://github.com/opentok/OpenTok-Ruby-SDK/pull/147)

# Release v2.4.0

This updates includes the following changes:

- [Adds support for filtering archives by session ID](https://github.com/opentok/OpenTok-Ruby-SDK/pull/143)
- [Adds support for JWT `X-OPENTOK-AUTH` header, replacing the deprecated `X-TB-PARTNER-AUTH` header](https://github.com/opentok/OpenTok-Ruby-SDK/pull/134)
- [Updates the REST API endpoint URL to use `/project/` replacing the deprecated `/partner/`](https://github.com/opentok/OpenTok-Ruby-SDK/pull/129)

As well as:

- Updates JS code in samples to use latest API and best practices ([#140](https://github.com/opentok/OpenTok-Ruby-SDK/pull/140) and [#144](https://github.com/opentok/OpenTok-Ruby-SDK/pull/144))
- Removes generated HTML docs from this repo
- Updates documentation

# Release v2.4.0.beta.1

This update includes support for the `initial_layout_class_list` feature of tokens.

# Release v2.3.4

This update addresses an issue with loading the opentok gem in certain Rails based projects. (see: [#109](https://github.com/opentok/OpenTok-Ruby-SDK/issues/109), [#113](https://github.com/opentok/OpenTok-Ruby-SDK/pull/113). thanks [@LuckDragon82](https://github.com/LuckDragon82)!)

# Release v2.3.3

This release adds an internal option on the OpenTok initializer used to customize the User Agent string. ([#108](https://github.com/opentok/OpenTok-Ruby-SDK/pull/108))

# Release v2.3.2

This release fixes an issue where connection timeouts are too aggressive. It doubles the time allowed while also only counting the time it takes for TCP connect to finish, not the entire HTTP response to be received ([#106](https://github.com/opentok/OpenTok-Ruby-SDK/pull/106) thanks [@dramalho](https://github.com/dramalho))

# Release v2.3.0

New archiving features:
- Automatically archived sessions -- See the `:archive_mode` option of the `OpenTok#create_session()` method.
- Audio-only or video-only archives -- See the `:has_audio` and `:has_video` parameters of the `OpenTok#archives.create()` method.
- Individual archiving -- See the `:output_mode` parameter of the `OpenTok#archives.create()` method.
- Paused archives -- When no clients are publishing to a session being archived, its status changes to "paused". See `Archive#status`.

Other improvements:
- Adds default HTTP timeout for requests ([#78](https://github.com/opentok/OpenTok-Ruby-SDK/pull/78) thanks [@dramalho](https://github.com/dramalho))
- Fixes Archiving sample app ([#96](https://github.com/opentok/OpenTok-Ruby-SDK/pull/96) thanks [@matsubo](https://github.com/matsubo))

# Release v2.2.4

- Ruby 2.2.0 compatibility (thanks [@superacidjax](https://github.com/superacidjax)) [#80](https://github.com/opentok/OpenTok-Ruby-SDK/pull/80)
- Uses updated REST API for `archives.create` and `archives.stop_by_id` [#49](https://github.com/opentok/OpenTok-Ruby-SDK/issues/49) [#88](https://github.com/opentok/OpenTok-Ruby-SDK/issues/88)
- Adds `rake console` task for gem authors [#91](https://github.com/opentok/OpenTok-Ruby-SDK/pull/91)

# Release v2.2.3

This version fixes a bug related to users on Windows receiving an `OpenTokAuthenticationError` exception because of a bug in an older version of the `httparty` gem. See [#60](https://github.com/opentok/OpenTok-Ruby-SDK/issues/60)

# Release v2.2.2

The default setting for the `create_session()` method is to create a session with the media mode set
to relayed. In previous versions of the SDK, the default setting was to use the OpenTok Media Router
(media mode set to routed). In a relayed session, clients will attempt to send streams directly
between each other (peer-to-peer); if clients cannot connect due to firewall restrictions, the
session uses the OpenTok TURN server to relay audio-video streams.

# Release v2.2.0

This version of the SDK includes support for working with OpenTok 2.0 archives. (This API does not
work with OpenTok 1.0 archives.)

Note also that the `options` parameter of the `OpenTok.create_session()` method has a `media_mode`
property instead of a `p2p` property.

# v0.1.3

Fixes issues:

- [#48](https://github.com/opentok/OpenTok-Ruby-SDK/issues/48) - OpenTokException given invalid number or parameters
51 changes: 49 additions & 2 deletions lib/opentok/archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,26 @@ module OpenTok
# Whether all streams in the archive are recorded to a single file (<code>:composed</code>)
# or to individual files (<code>:individual</code>).
#
# @attr [string] partner_id
# @attr [string] projectId
# The API key associated with the archive.
#
# @attr [string] reason
# For archives with the status "stopped" or "failed", this string describes the
# reason the archive stopped (such as "maximum duration exceeded") or failed.
#
# @attr [string] resolution
# The resolution of the archive (either "640x480", "1280x720", "480x640", or "720x1280").
# This property is only set for composed archives.
#
# @attr [string] session_id
# The session ID of the OpenTok session associated with this archive.
#
# @attr [float] size
# The size of the MP4 file. For archives that have not been generated, this value is set to 0.
#
# @attr [string] streamMode
# Whether streams included in the archive are selected automatically ("auto", the default) or manually ("manual").
#
# @attr [string] status
# The status of the archive, which can be one of the following:
#
Expand Down Expand Up @@ -99,7 +106,7 @@ def delete
# {https://tokbox.com/developer/guides/archiving/layout-control.html Customizing
# the video layout for composed archives}.
#
# @option options [String] :type
# @option options [String] :type
# The layout type. Set this to "bestFit", "pip", "verticalPresentation",
# "horizontalPresentation", "focus", or "custom".
#
Expand Down Expand Up @@ -136,6 +143,46 @@ def layout(opts= {})
@json = @interface.layout(@json['id'], opts)
end

# Adds a stream to currently running composed archive that was started with the
# streamMode set to "manual". For a description of the feature, see
# {https://tokbox.com/developer/rest/#selecting-archive-streams}.
#
# @param [String] stream_id
# The ID for the stream to be added to the archive
#
# @option opts [true, false] :has_audio
# (Boolean, optional) — Whether the composed archive should include the stream's
# audio (true, the default) or not (false).
#
# @option opts [true, false] :has_video
# (Boolean, optional) — Whether the composed archive should include the stream's
# video (true, the default) or not (false).
#
# @raise [OpenTokArchiveError]
# The streamMode for the archive is not set to "manual".
#
# You can call the method repeatedly with add_stream set to the same stream ID, to
# toggle the stream's audio or video in the archive. If you set both has_audio and
# has_video to false, you will get error response.
def add_stream(stream_id, opts = {})
raise OpenTokArchiveError, "stream_mode must be manual in order to add a stream" unless @json['streamMode'] == 'manual'
@interface.add_stream(@json['id'], stream_id, opts)
end

# Removes a stream to currently running composed archive that was started with the
# streamMode set to "manual". For a description of the feature, see
# {https://tokbox.com/developer/rest/#selecting-archive-streams}.
#
# @param [String] stream_id
# The ID for the stream to be removed from the archive
#
# @raise [OpenTokArchiveError]
# The streamMode for the archive is not set to "manual".
def remove_stream(stream_id)
raise OpenTokArchiveError, "stream_mode must be manual in order to remove a stream" unless @json['streamMode'] == 'manual'
@interface.remove_stream(@json['id'], stream_id)
end

# @private ignore
def method_missing(method, *args, &block)
camelized_method = method.to_s.camelize(:lower)
Expand Down
93 changes: 89 additions & 4 deletions lib/opentok/archives.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,19 @@ def initialize(client)
# default) or "1280x720" (HD). This property only applies to composed archives. If you set
# this property and set the outputMode property to "individual", the call the method
# results in an error.
# @option options [String] :streamMode (Optional) Whether streams included in the archive are selected
# automatically ("auto", the default) or manually ("manual"). When streams are selected automatically ("auto"),
# all streams in the session can be included in the archive. When streams are selected manually ("manual"),
# you specify streams to be included based on calls to this REST method
# { https://tokbox.com/developer/rest/#selecting-archive-streams }. You can specify whether a
# stream's audio, video, or both are included in the archive.
# In composed archives, in both automatic and manual modes, the archive composer includes streams based
# on stream prioritization rules { https://tokbox.com/developer/guides/archive-broadcast-layout/#stream-prioritization-rules }.
# Important: this feature is currently available in the Standard environment only.
# @option options [Hash] :layout Specify this to assign the initial layout type for
# the archive. This applies only to composed archives. This is a hash containing three keys:
# <code>:type</code>, <code>:stylesheet<code> and <code>:screenshare_type</code>.
# Valid values for <code>:type</code> are "bestFit" (best fit), "custom" (custom),
# <code>:type</code>, <code>:stylesheet<code> and <code>:screenshare_type</code>.
# Valid values for <code>:type</code> are "bestFit" (best fit), "custom" (custom),
# "horizontalPresentation" (horizontal presentation),
# "pip" (picture-in-picture), and "verticalPresentation" (vertical presentation)).
# If you specify a "custom" layout type, set the <code>:stylesheet</code> key to the
Expand Down Expand Up @@ -171,10 +180,10 @@ def delete_by_id(archive_id)
# {https://tokbox.com/developer/guides/archiving/layout-control.html Customizing
# the video layout for composed archives}.
#
# @param [String] archive_id
# @param [String] archive_id
# The archive ID.
#
# @option options [String] :type
# @option options [String] :type
# The layout type. Set this to "bestFit", "pip", "verticalPresentation",
# "horizontalPresentation", "focus", or "custom".
#
Expand Down Expand Up @@ -226,5 +235,81 @@ def layout(archive_id, options = {})
response = @client.layout_archive(archive_id, options)
(200..300).include? response.code
end

# Adds a stream to currently running composed archive that was started with the
# streamMode set to "manual". For a description of the feature, see
# {https://tokbox.com/developer/rest/#selecting-archive-streams}.
#
# @param [String] archive_id
# The archive ID.
#
# @param [String] stream_id
# The ID for the stream to be added to the archive
#
# @option opts [true, false] :has_audio
# (Boolean, optional) — Whether the composed archive should include the stream's
# audio (true, the default) or not (false).
#
# @option opts [true, false] :has_video
# (Boolean, optional) — Whether the composed archive should include the stream's
# video (true, the default) or not (false).
#
# You can call the method repeatedly with add_stream set to the same stream ID, to
# toggle the stream's audio or video in the archive. If you set both has_audio and
# has_video to false, you will get error response.
#
# @raise [ArgumentError]
# The archive_id parameter is empty.
#
# @raise [ArgumentError]
# The stream_id parameter is empty.
#
# @raise [ArgumentError]
# The has_audio and has_video properties of the options parameter are both set to "false"
#
def add_stream(archive_id, stream_id, options)
raise ArgumentError, "archive_id not provided" if archive_id.to_s.empty?
raise ArgumentError, "stream_id not provided" if stream_id.to_s.empty?
if options.has_key?(:has_audio) && options.has_key?(:has_video)
has_audio = options[:has_audio]
has_video = options[:has_video]
raise ArgumentError, "has_audio and has_video can't both be false" if audio_and_video_options_both_false?(has_audio, has_video)
end
options['add_stream'] = stream_id

@client.select_streams_for_archive(archive_id, options)
end

# Removes a stream from a currently running composed archive that was started with the
# streamMode set to "manual". For a description of the feature, see
# {https://tokbox.com/developer/rest/#selecting-archive-streams}.
#
# @param [String] archive_id
# The archive ID.
#
# @param [String] stream_id
# The ID for the stream to be removed from the archive
#
# @raise [ArgumentError]
# The archive_id parameter id is empty.
#
# @raise [ArgumentError]
# The stream_id parameter is empty.
#
def remove_stream(archive_id, stream_id)
raise ArgumentError, "archive_id not provided" if archive_id.to_s.empty?
raise ArgumentError, "stream_id not provided" if stream_id.to_s.empty?
options = {}
options['remove_stream'] = stream_id

@client.select_streams_for_archive(archive_id, options)
end

private

def audio_and_video_options_both_false?(has_audio, has_video)
has_audio == false && has_video == false
end

end
end
Loading

0 comments on commit ed1908e

Please sign in to comment.