opentok 4.1.0 → 4.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +30 -0
  3. data/.github/workflows/metrics.yml +17 -0
  4. data/CHANGES.md +171 -0
  5. data/README.md +62 -38
  6. data/lib/opentok/archive.rb +54 -4
  7. data/lib/opentok/archives.rb +115 -11
  8. data/lib/opentok/broadcast.rb +50 -3
  9. data/lib/opentok/broadcast_list.rb +14 -0
  10. data/lib/opentok/broadcasts.rb +178 -19
  11. data/lib/opentok/client.rb +251 -0
  12. data/lib/opentok/connections.rb +1 -1
  13. data/lib/opentok/constants.rb +1 -0
  14. data/lib/opentok/exceptions.rb +3 -1
  15. data/lib/opentok/opentok.rb +16 -10
  16. data/lib/opentok/render.rb +78 -0
  17. data/lib/opentok/render_list.rb +14 -0
  18. data/lib/opentok/renders.rb +101 -0
  19. data/lib/opentok/session.rb +4 -4
  20. data/lib/opentok/sip.rb +40 -2
  21. data/lib/opentok/streams.rb +49 -2
  22. data/lib/opentok/token_generator.rb +1 -0
  23. data/lib/opentok/version.rb +1 -1
  24. data/opentok.gemspec +2 -1
  25. data/sample/Broadcast/README.md +42 -0
  26. data/sample/Broadcast/broadcast_sample.rb +15 -0
  27. data/sample/Broadcast/views/all.erb +46 -0
  28. data/sample/Broadcast/views/index.erb +16 -1
  29. data/spec/cassettes/OpenTok_Archives/adds_a_stream_to_an_archive.yml +37 -0
  30. data/spec/cassettes/OpenTok_Archives/removes_a_stream_from_an_archive.yml +37 -0
  31. data/spec/cassettes/OpenTok_Archives/should_create_an_archive_with_matching_multi_archive_tag_when_multiArchiveTag_is_specified.yml +50 -0
  32. data/spec/cassettes/OpenTok_Archives/should_create_an_archive_with_multi_archive_tag_value_of_nil_when_multiArchiveTag_not_specified.yml +49 -0
  33. data/spec/cassettes/OpenTok_Archives/should_create_an_archives_with_a_specified_multiArchiveTag.yml +52 -0
  34. data/spec/cassettes/OpenTok_Archives/should_create_layout_archives_with_screenshare_layout_types.yml +50 -0
  35. data/spec/cassettes/OpenTok_Broadcasts/adds_a_stream_to_a_broadcast.yml +37 -0
  36. data/spec/cassettes/OpenTok_Broadcasts/for_many_broadcasts/should_return_all_broadcasts.yml +192 -0
  37. data/spec/cassettes/OpenTok_Broadcasts/for_many_broadcasts/should_return_broadcasts_with_an_offset.yml +117 -0
  38. data/spec/cassettes/OpenTok_Broadcasts/for_many_broadcasts/should_return_count_number_of_broadcasts.yml +92 -0
  39. data/spec/cassettes/OpenTok_Broadcasts/for_many_broadcasts/should_return_part_of_the_broadcasts_when_using_offset_and_count.yml +142 -0
  40. data/spec/cassettes/OpenTok_Broadcasts/for_many_broadcasts/should_return_session_broadcasts.yml +117 -0
  41. data/spec/cassettes/OpenTok_Broadcasts/removes_a_stream_from_a_broadcast.yml +37 -0
  42. data/spec/cassettes/OpenTok_Broadcasts/starts_a_broadcast_with_a_matching_multi_broadcast_tag_value_when_multiBroadcastTag_is_specified.yml +54 -0
  43. data/spec/cassettes/OpenTok_Broadcasts/starts_a_broadcast_with_a_multi_broadcast_tag_value_of_nil_when_multiBroadcastTag_not_specified.yml +53 -0
  44. data/spec/cassettes/OpenTok_Broadcasts/starts_a_broadcast_with_a_specified_multiBroadcastTag.yml +54 -0
  45. data/spec/cassettes/OpenTok_Renders/finds_an_Experience_Composer_render.yml +46 -0
  46. data/spec/cassettes/OpenTok_Renders/for_many_renders/should_return_all_renders.yml +108 -0
  47. data/spec/cassettes/OpenTok_Renders/for_many_renders/should_return_count_number_of_renders.yml +63 -0
  48. data/spec/cassettes/OpenTok_Renders/for_many_renders/should_return_part_of_the_renders_when_using_offset_and_count.yml +63 -0
  49. data/spec/cassettes/OpenTok_Renders/for_many_renders/should_return_renders_with_an_offset.yml +74 -0
  50. data/spec/cassettes/OpenTok_Renders/starts_an_Experience_Composer_render.yml +48 -0
  51. data/spec/cassettes/OpenTok_Renders/stops_an_Experience_Composer_render.yml +28 -0
  52. data/spec/cassettes/OpenTok_Sip/_play_dtmf_to_connection/returns_a_200_response_code_when_passed_a_valid_dtmf_digit_string.yml +39 -0
  53. data/spec/cassettes/OpenTok_Sip/_play_dtmf_to_session/returns_a_200_response_code_when_passed_a_valid_dtmf_digit_string.yml +39 -0
  54. data/spec/cassettes/OpenTok_Sip/receives_a_valid_response.yml +2 -2
  55. data/spec/cassettes/OpenTok_Streams/disables_the_mute_state_of_a_session.yml +37 -0
  56. data/spec/cassettes/OpenTok_Streams/forces_all_current_and_future_streams_in_a_session_to_be_muted.yml +39 -0
  57. data/spec/cassettes/OpenTok_Streams/forces_all_current_and_future_streams_in_a_session_to_be_muted_except_specified_excluded_streams.yml +39 -0
  58. data/spec/cassettes/OpenTok_Streams/forces_the_specified_stream_to_be_muted.yml +39 -0
  59. data/spec/opentok/archives_spec.rb +61 -0
  60. data/spec/opentok/broadcasts_spec.rb +157 -1
  61. data/spec/opentok/connection_spec.rb +1 -1
  62. data/spec/opentok/opentok_spec.rb +6 -0
  63. data/spec/opentok/renders_spec.rb +142 -0
  64. data/spec/opentok/sip_spec.rb +32 -1
  65. data/spec/opentok/streams_spec.rb +21 -1
  66. metadata +75 -7
  67. data/.travis.yml +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 348ea4d3600d65e0e68b7078f4b694144c1eb03410ef46dccf2b27f235fd4c34
4
- data.tar.gz: 900521793c8e747b77b50a081a83328a004df84231a048f6f5b6e07a75d7bbbd
3
+ metadata.gz: 78dc7ec3b0d8d3097e687cc0e7b76d2c9d18e3969372c54a00e3c4f3c95846ed
4
+ data.tar.gz: e8c10144c89329205734d7d0dd5c8fb37197c2af0a50401a1d97ec1cbfe9e837
5
5
  SHA512:
6
- metadata.gz: ac9f2f38462314084442b364b63af518569bc1931ffd70300be797a295303648236c28cb910a88804b0d63cc110194ae30334c7ea1a4e25be7f0ccaa148c676a
7
- data.tar.gz: aa8d99ffc987557ed346c3e9188057aa3239d77f88da4d94f09cb39c4283447a27bc0e39da2fff007095a8268bf9b14aed623d7748371a0d3385fa329cb91a2f
6
+ metadata.gz: 9b481dc1985ffa39e3c371c2d67fc3b6e7b1cdc696db7e21274bea45e0784984facb5cdfdda92bc14f3366af243e8c01f448bc5ddb7cba52e935a8c97bd15694
7
+ data.tar.gz: f776558162063de46f8e7e4da99032ec771171098f7cc2e4a2c260374061ec0c840d479e530b2efb24f8ad3754f0da95a27c12a24cdd97c0013680ac31e5b5f7
@@ -0,0 +1,30 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, dev, beta ]
6
+ pull_request:
7
+ branches: [ main, dev, beta ]
8
+
9
+ jobs:
10
+ test:
11
+ strategy:
12
+ matrix:
13
+ os: [ubuntu-latest, windows-latest, macos-latest]
14
+ ruby: [2.5, 2.6, 2.7, 3.0]
15
+ exclude:
16
+ - os: windows-latest
17
+ ruby: 3.0
18
+ runs-on: ${{ matrix.os }}
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ - name: Install dependencies
26
+ run: bundle install
27
+ - name: Run tests
28
+ run: bundle exec rake spec
29
+ env:
30
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,17 @@
1
+ name: Aggregit
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "0 0 * * *"
6
+
7
+ jobs:
8
+ recordMetrics:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: michaeljolley/aggregit@v1
12
+ with:
13
+ githubToken: ${{ secrets.GITHUB_TOKEN }}
14
+ project_id: ${{ secrets.project_id }}
15
+ private_key: ${{ secrets.private_key }}
16
+ client_email: ${{ secrets.client_email }}
17
+ firebaseDbUrl: ${{ secrets.firebaseDbUrl }}
data/CHANGES.md ADDED
@@ -0,0 +1,171 @@
1
+ # 4.5.1
2
+
3
+ * Fixes issue with uninitialized constant by adding missing `require` statement [#256](https://github.com/opentok/OpenTok-Ruby-SDK/pull/256)
4
+ * Fixes RubyGems info by adding repo link to gemspec [#255](https://github.com/opentok/OpenTok-Ruby-SDK/pull/255)
5
+
6
+ Thanks to [`@sailor`](https://github.com/sailor) for the contributions! :raised_hands:
7
+
8
+ # 4.5.0
9
+
10
+ * Adds support for multiple archives and records feature [#248](https://github.com/opentok/OpenTok-Ruby-SDK/pull/248)
11
+ * Adds Experience Composer functionality [#249](https://github.com/opentok/OpenTok-Ruby-SDK/pull/249)
12
+ * Updates code comments to make explicit support for 1080p resolution for Archive and Broadcast [#246](https://github.com/opentok/OpenTok-Ruby-SDK/pull/246)
13
+ * Updates various other documentation/code comments [#250](https://github.com/opentok/OpenTok-Ruby-SDK/pull/250)
14
+
15
+ # 4.4.0
16
+
17
+ * Implements DVR Pause/Resume and HLS Low-Latency options for Broadcasts [#243](https://github.com/opentok/OpenTok-Ruby-SDK/pull/243)
18
+
19
+ # 4.3.0
20
+
21
+ * Fixes an issue with `activesupport` [#238](https://github.com/opentok/OpenTok-Ruby-SDK/pull/238)
22
+ * 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)
23
+ * Adds Listing Live Streaming Broadcasts feature [#236](https://github.com/opentok/OpenTok-Ruby-SDK/pull/236). Thanks [@ihors-livestorm](https://github.com/ihors-livestorm)!
24
+ * Adds Selective Stream feature [#235](https://github.com/opentok/OpenTok-Ruby-SDK/pull/235)
25
+ * Adds Dial DTMF feature [#234](https://github.com/opentok/OpenTok-Ruby-SDK/pull/234)
26
+ * Adds Observe Force Mute flag to `Sip#dial` method [#232](https://github.com/opentok/OpenTok-Ruby-SDK/pull/232)
27
+ * Updates dependency version (`rake`) [#231](https://github.com/opentok/OpenTok-Ruby-SDK/pull/231)
28
+ * Adds Video Outbound flag to `Sip#dial` method [#227](https://github.com/opentok/OpenTok-Ruby-SDK/pull/227)
29
+
30
+ # 4.2.0
31
+
32
+ * 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/
33
+
34
+ # 4.1.2 Release
35
+
36
+ Fixes an issue with custom broadcast layout [#218](https://github.com/opentok/OpenTok-Ruby-SDK/pull/218)
37
+
38
+ # 4.1.1
39
+
40
+ Patch release to address issue corrected in [#214](https://github.com/opentok/OpenTok-Ruby-SDK/pull/214)
41
+
42
+ # Release v4.1.0
43
+
44
+ Add a `timeout_length` custom parameter that allows for the specification in seconds to wait before timing out for HTTP requests.
45
+
46
+ # Release 4.0.1
47
+
48
+ * Addresses an issue with invocation of `Set` in rubies v2.5
49
+ * Updates cassettes for request header changes in HTTParty
50
+
51
+ # Release 4.0.0
52
+
53
+ * Update gems (thanks [@fidalgo](https://github.com/fidalgo))
54
+ * Adds Ruby 2.7 support
55
+ * Removes Ruby 2.0 support. (For Ruby v2.0.0 please continue to use the OpenTok Ruby SDK v3.0.0.)
56
+ * Add layout to archive create (thanks [@mjthompsgb](https://github.com/mjthompsgb))
57
+ * Broadcast sample (thanks [@IGitGotIt](https://github.com/IGitGotIt))
58
+
59
+ # Release v3.1.0
60
+
61
+ Adds the following APIs (Thanks @JayTokBox & [@normanargueta](https://github.com/normanargueta)):
62
+ - Force Disconnect
63
+ - Signaling
64
+ - Resolution Support
65
+ - Archive Layouts
66
+ - Broadcasting APIs
67
+ - Get & List streams
68
+
69
+ Updates and improves documentation! (Thanks [@jeffswartz](https://github.com/jeffswartz) )
70
+
71
+ # Release v3.0.3
72
+
73
+ Fixes internal logging and useragent issue
74
+
75
+ # Release v3.0.1
76
+
77
+ Upgraded dependency version ([#155](https://github.com/opentok/OpenTok-Ruby-SDK/pull/155))
78
+
79
+ # Release v3.0.0
80
+
81
+ Updating the version of httparty to 0.15. This is a breaking change because we require Ruby >= 2.0.0 now.
82
+
83
+
84
+ # Release v2.5.0
85
+
86
+ This updates includes the following change:
87
+
88
+ - [Add a dial method to initiate a SIP call](https://github.com/opentok/OpenTok-Ruby-SDK/pull/133)
89
+
90
+ Thanks @herestomwiththeweather!
91
+
92
+ # Release v2.4.1
93
+
94
+ This updates includes the following changes:
95
+
96
+ - [Support for the initial_layout_class_list feature of tokens](https://github.com/opentok/OpenTok-Ruby-SDK/pull/146)
97
+ - [Remove unnecessary info param from JS samples](https://github.com/opentok/OpenTok-Ruby-SDK/pull/147)
98
+
99
+ # Release v2.4.0
100
+
101
+ This updates includes the following changes:
102
+
103
+ - [Adds support for filtering archives by session ID](https://github.com/opentok/OpenTok-Ruby-SDK/pull/143)
104
+ - [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)
105
+ - [Updates the REST API endpoint URL to use `/project/` replacing the deprecated `/partner/`](https://github.com/opentok/OpenTok-Ruby-SDK/pull/129)
106
+
107
+ As well as:
108
+
109
+ - 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))
110
+ - Removes generated HTML docs from this repo
111
+ - Updates documentation
112
+
113
+ # Release v2.4.0.beta.1
114
+
115
+ This update includes support for the `initial_layout_class_list` feature of tokens.
116
+
117
+ # Release v2.3.4
118
+
119
+ 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)!)
120
+
121
+ # Release v2.3.3
122
+
123
+ 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))
124
+
125
+ # Release v2.3.2
126
+
127
+ 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))
128
+
129
+ # Release v2.3.0
130
+
131
+ New archiving features:
132
+ - Automatically archived sessions -- See the `:archive_mode` option of the `OpenTok#create_session()` method.
133
+ - Audio-only or video-only archives -- See the `:has_audio` and `:has_video` parameters of the `OpenTok#archives.create()` method.
134
+ - Individual archiving -- See the `:output_mode` parameter of the `OpenTok#archives.create()` method.
135
+ - Paused archives -- When no clients are publishing to a session being archived, its status changes to "paused". See `Archive#status`.
136
+
137
+ Other improvements:
138
+ - Adds default HTTP timeout for requests ([#78](https://github.com/opentok/OpenTok-Ruby-SDK/pull/78) thanks [@dramalho](https://github.com/dramalho))
139
+ - Fixes Archiving sample app ([#96](https://github.com/opentok/OpenTok-Ruby-SDK/pull/96) thanks [@matsubo](https://github.com/matsubo))
140
+
141
+ # Release v2.2.4
142
+
143
+ - Ruby 2.2.0 compatibility (thanks [@superacidjax](https://github.com/superacidjax)) [#80](https://github.com/opentok/OpenTok-Ruby-SDK/pull/80)
144
+ - 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)
145
+ - Adds `rake console` task for gem authors [#91](https://github.com/opentok/OpenTok-Ruby-SDK/pull/91)
146
+
147
+ # Release v2.2.3
148
+
149
+ 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)
150
+
151
+ # Release v2.2.2
152
+
153
+ The default setting for the `create_session()` method is to create a session with the media mode set
154
+ to relayed. In previous versions of the SDK, the default setting was to use the OpenTok Media Router
155
+ (media mode set to routed). In a relayed session, clients will attempt to send streams directly
156
+ between each other (peer-to-peer); if clients cannot connect due to firewall restrictions, the
157
+ session uses the OpenTok TURN server to relay audio-video streams.
158
+
159
+ # Release v2.2.0
160
+
161
+ This version of the SDK includes support for working with OpenTok 2.0 archives. (This API does not
162
+ work with OpenTok 1.0 archives.)
163
+
164
+ Note also that the `options` parameter of the `OpenTok.create_session()` method has a `media_mode`
165
+ property instead of a `p2p` property.
166
+
167
+ # v0.1.3
168
+
169
+ Fixes issues:
170
+
171
+ - [#48](https://github.com/opentok/OpenTok-Ruby-SDK/issues/48) - OpenTokException given invalid number or parameters
data/README.md CHANGED
@@ -1,22 +1,27 @@
1
1
  # OpenTok Ruby SDK
2
2
 
3
- [![Build Status](https://travis-ci.org/opentok/OpenTok-Ruby-SDK.png)](https://travis-ci.org/opentok/OpenTok-Ruby-SDK) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
3
+ ![Coverage Status](https://github.com/opentok/OpenTok-Ruby-SDK/workflows/CI/badge.svg)
4
+ [![codecov](https://codecov.io/gh/opentok/OpenTok-Ruby-SDK/branch/master/graph/badge.svg)](https://codecov.io/gh/opentok/opentok-ruby-sdk)
5
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
4
6
 
5
7
  <img src="https://assets.tokbox.com/img/vonage/Vonage_VideoAPI_black.svg" height="48px" alt="Tokbox is now known as Vonage" />
6
8
 
7
- The OpenTok Ruby SDK lets you generate
8
- [sessions](https://tokbox.com/developer/guides/create-session/) and
9
- [tokens](https://tokbox.com/developer/guides/create-token/) for
10
- [OpenTok](http://www.tokbox.com/) applications. It also includes methods for
11
- working with OpenTok [archives](https://tokbox.com/developer/guides/archiving),
12
- working with OpenTok [live streaming
13
- broadcasts](https://tokbox.com/developer/guides/broadcast/live-streaming/),
14
- working with OpenTok [SIP interconnect](https://tokbox.com/developer/guides/sip),
15
- and [disconnecting clients from sessions](https://tokbox.com/developer/guides/moderation/rest/).
9
+ The OpenTok Ruby SDK provides methods for:
16
10
 
17
- # Installation
11
+ * Generating [sessions](https://tokbox.com/developer/guides/create-session/) and
12
+ [tokens](https://tokbox.com/developer/guides/create-token/) for
13
+ [OpenTok](https://www.vonage.com/communications-apis/video/) applications
14
+ * Working with OpenTok [archives](https://tokbox.com/developer/guides/archiving)
15
+ * Working with OpenTok [live streaming broadcasts](https://tokbox.com/developer/guides/broadcast/live-streaming/)
16
+ * Working with OpenTok [SIP interconnect](https://tokbox.com/developer/guides/sip)
17
+ * [Sending signals to clients connected to a session](https://tokbox.com/developer/guides/signaling/)
18
+ * [Disconnecting clients from sessions](https://tokbox.com/developer/guides/moderation/rest/)
19
+ * [Forcing clients in a session to disconnect or mute published audio](https://tokbox.com/developer/guides/moderation/)
20
+ * Working with OpenTok [Experience Composers](https://tokbox.com/developer/guides/experience-composer)
18
21
 
19
- ## Bundler (recommended):
22
+ ## Installation
23
+
24
+ ### Bundler (recommended):
20
25
 
21
26
  Bundler helps manage dependencies for Ruby projects. Find more info here: <http://bundler.io>
22
27
 
@@ -32,15 +37,15 @@ Allow bundler to install the change.
32
37
  $ bundle install
33
38
  ```
34
39
 
35
- ## RubyGems:
40
+ ### RubyGems:
36
41
 
37
42
  ```
38
43
  $ gem install opentok
39
44
  ```
40
45
 
41
- # Usage
46
+ ## Usage
42
47
 
43
- ## Initializing
48
+ ### Initializing
44
49
 
45
50
  Load the gem at the top of any file where it will be used. Then initialize an `OpenTok::OpenTok`
46
51
  object with your OpenTok API key and API secret.
@@ -51,7 +56,7 @@ require "opentok"
51
56
  opentok = OpenTok::OpenTok.new api_key, api_secret
52
57
  ```
53
58
 
54
- ### Initialization Options
59
+ #### Initialization Options
55
60
 
56
61
  You can specify a custom timeout value for HTTP requests when initializing a new `OpenTok::OpenTok`
57
62
  object:
@@ -65,7 +70,7 @@ opentok = OpenTok::OpenTok.new api_key, api_secret, :timeout_length => 10
65
70
  The value for `:timeout_length` is an integer representing the number of seconds to wait for an HTTP
66
71
  request to complete. The default is set to 2 seconds.
67
72
 
68
- ## Creating Sessions
73
+ ### Creating Sessions
69
74
 
70
75
  To create an OpenTok Session, use the `OpenTok#create_session(properties)` method.
71
76
  The `properties` parameter is an optional Hash used to specify the following:
@@ -99,7 +104,7 @@ session = opentok.create_session :archive_mode => :always, :media_mode => :route
99
104
  session_id = session.session_id
100
105
  ```
101
106
 
102
- ## Generating Tokens
107
+ ### Generating Tokens
103
108
 
104
109
  Once a Session is created, you can start generating Tokens for clients to use when connecting to it.
105
110
  You can generate a token either by calling the `opentok.generate_token(session_id, options)` method,
@@ -109,7 +114,7 @@ the Token. For layout control in archives and broadcasts, the initial layout cla
109
114
  published from connections using this token can be set as well.
110
115
 
111
116
  ```ruby
112
- # Generate a Token from just a session_id (fetched from a database)
117
+ ## Generate a Token from just a session_id (fetched from a database)
113
118
  token = opentok.generate_token session_id
114
119
 
115
120
  # Generate a Token by calling the method on the Session (returned from createSession)
@@ -124,7 +129,7 @@ token = session.generate_token({
124
129
  });
125
130
  ```
126
131
 
127
- ## Working with Streams
132
+ ### Working with Streams
128
133
 
129
134
  Use this method to get information for an OpenTok stream or for all streams in a session.
130
135
  For example, you can call this method to get information about layout classes used by an
@@ -150,7 +155,7 @@ expect(all_streams.total).to eq 2
150
155
  expect(all_streams[0].layoutClassList[1]).to eq "focus"
151
156
  ```
152
157
 
153
- ## Working with Archives
158
+ ### Working with Archives
154
159
 
155
160
  You can only archive sessions that use the OpenTok Media Router
156
161
  (sessions with the media mode set to routed).
@@ -183,8 +188,7 @@ archive = opentok.archives.create session_id :output_mode => :individual
183
188
  The `:output_mode => :composed` setting (the default) causes all streams in the archive to be
184
189
  recorded to a single (composed) file.
185
190
 
186
- For composed archives you can set the resolution of the archive, either "640x480" (SD, the default)
187
- or "1280x720" (HD). The `resolution` parameter is optional and could be included in the options
191
+ For composed archives you can set the resolution of the archive, either "640x480" (SD landscape, the default), "1280x720" (HD landscape), "1920x1080" (FHD landscape), "480x640" (SD portrait), "720x1280" (HD portrait), or "1080x1920" (FHD portrait).. The `resolution` parameter is optional and could be included in the options
188
192
  hash (second argument) of the `opentok.archives.create()` method.
189
193
 
190
194
  ```ruby
@@ -314,9 +318,9 @@ stream](https://tokbox.com/developer/rest/#change-stream-layout-classes-composed
314
318
  Please keep in mind that the `streams.layout` method applies to archive and broadcast streams only.
315
319
 
316
320
  For more information on archiving, see the
317
- [OpenTok archiving](https://tokbox.com/opentok/tutorials/archiving/) programming guide.
321
+ [OpenTok archiving](/developer/guides/archiving/) developer guide.
318
322
 
319
- ## Signaling
323
+ ### Signaling
320
324
 
321
325
  You can send a signal using the `opentok.signals.send(session_id, connection_id, opts)` method.
322
326
  If `connection_id` is nil or an empty string, then the signal is send to all valid connections in
@@ -341,16 +345,13 @@ use `opentok.signals.send(session_id)`
341
345
  For more information on signaling, see the
342
346
  [OpenTok Signaling](https://tokbox.com/developer/guides/signaling/js/) programming guide.
343
347
 
344
- ## Broadcasting
348
+ ### Broadcasting
345
349
 
346
350
  You can broadcast your streams to a HLS or RTMP servers.
347
351
 
348
352
  To successfully start broadcasting a session, at least one publishing client must be connected to
349
353
  the session.
350
354
 
351
- You can only have one active live streaming broadcast at a time for a session (however, having more
352
- than one would not be useful).
353
-
354
355
  The live streaming broadcast can target one HLS endpoint and up to five RTMP servers simultaneously
355
356
  for a session.
356
357
 
@@ -449,12 +450,25 @@ for more details.
449
450
  You can also change the layout of an individual stream dynamically. Refer to
450
451
  [working with Streams](#working-with-streams).
451
452
 
452
- ## Force disconnect
453
+ ### Force disconnect
453
454
 
454
455
  You can cause a client to be forced to disconnect from a session by using the
455
456
  `opentok.connections.forceDisconnect(session_id, connection_id)` method.
456
457
 
457
- ## Initiating a SIP call
458
+ ### Forcing clients in a session to mute published audio
459
+
460
+ You can force the publisher of a specific stream to stop publishing audio using the
461
+ `opentok.streams.force_mute(session_id, stream_id)` method.
462
+
463
+ You can force the publisher of all streams in a session (except for an optional list of streams)
464
+ to stop publishing audio using the `opentok.streams.force_mute_all(session_id, opts)`
465
+ method. You can then disable the mute state of the session by calling the
466
+ `opentok.streams.disable_force_mute(session_id)` method.
467
+
468
+ For more information, see
469
+ [Muting the audio of streams in a session](https://tokbox.com/developer/guides/moderation/#force_mute).
470
+
471
+ ### Initiating a SIP call
458
472
 
459
473
  You can initiate a SIP call using the `opentok.sip.dial(session_id, token, sip_uri, opts)` method.
460
474
  This requires a SIP URL. You will often need to pass options for authenticating to the SIP provider
@@ -471,7 +485,17 @@ response = opentok.sip.dial(session_id, token, "sip:+15128675309@acme.pstn.examp
471
485
  For more information on SIP Interconnect, see the
472
486
  [OpenTok SIP Interconnect](https://tokbox.com/developer/guides/sip/) developer guide.
473
487
 
474
- # Samples
488
+ ### Working with Experience Composers
489
+
490
+ You can start an [Experience Composer](https://tokbox.com/developer/guides/experience-composer)
491
+ by calling the `opentok.renders.start(session_id, options)` method.
492
+
493
+ You can stop an Experience Composer by calling the `opentok.renders.stop(render_id, options)` method.
494
+
495
+ You can get information about Experience Composers by calling the `opentok.renders.find(render_id)`
496
+ and `opentok.renders.list(options)` methods.
497
+
498
+ ## Samples
475
499
 
476
500
  There are three sample applications included in this repository. To get going as fast as possible, clone the whole
477
501
  repository and read the README in each of the sample directories:
@@ -480,23 +504,23 @@ repository and read the README in each of the sample directories:
480
504
  - [Archiving](sample/Archiving/README.md)
481
505
  - [Broadcast](sample/Broadcast/README.md)
482
506
 
483
- # Documentation
507
+ ## Documentation
484
508
 
485
509
  Reference documentation is available at <http://www.tokbox.com//opentok/libraries/server/ruby/reference/index.html>.
486
510
 
487
- # Requirements
511
+ ## Requirements
488
512
 
489
513
  You need an OpenTok API key and API secret, which you can obtain by logging into your
490
- [TokBox account](https://tokbox.com/account).
514
+ [Vonage Video API account](https://tokbox.com/account).
491
515
 
492
516
  The OpenTok Ruby SDK requires Ruby 2.1.0 or greater.
493
517
 
494
- # Release Notes
518
+ ## Release Notes
495
519
 
496
520
  See the [Releases](https://github.com/opentok/opentok-ruby-sdk/releases) page for details
497
521
  about each release.
498
522
 
499
- ## Important changes since v2.2.0
523
+ ### Important changes since v2.2.0
500
524
 
501
525
  **Changes in v4.0.0:**
502
526
 
@@ -528,7 +552,7 @@ See the reference documentation
528
552
  <http://www.tokbox.com/opentok/libraries/server/ruby/reference/index.html> and in the
529
553
  docs directory of the SDK.
530
554
 
531
- # Development and Contributing
555
+ ## Development and Contributing
532
556
 
533
557
  Interested in contributing? We :heart: pull requests! See the [Development](DEVELOPING.md) and
534
558
  [Contribution](CONTRIBUTING.md) guidelines.
@@ -7,7 +7,7 @@ module OpenTok
7
7
  # The time at which the archive was created, in milliseconds since the UNIX epoch.
8
8
  #
9
9
  # @attr [string] duration
10
- # The duration of the archive, in milliseconds.
10
+ # The duration of the archive, in seconds.
11
11
  #
12
12
  # @attr [string] id
13
13
  # The archive ID.
@@ -26,19 +26,28 @@ module OpenTok
26
26
  # Whether all streams in the archive are recorded to a single file (<code>:composed</code>)
27
27
  # or to individual files (<code>:individual</code>).
28
28
  #
29
- # @attr [string] partner_id
29
+ # @attr [string] projectId
30
30
  # The API key associated with the archive.
31
31
  #
32
32
  # @attr [string] reason
33
33
  # For archives with the status "stopped" or "failed", this string describes the
34
34
  # reason the archive stopped (such as "maximum duration exceeded") or failed.
35
35
  #
36
+ # @attr [string] resolution
37
+ # The resolution of the archive, either "640x480" (SD landscape, the default), "1280x720" (HD landscape),
38
+ # "1920x1080" (FHD landscape), "480x640" (SD portrait), "720x1280" (HD portrait), or "1080x1920" (FHD portrait).
39
+ # You may want to use a portrait aspect ratio for archives that include video streams from mobile devices (which often use the portrait aspect ratio).
40
+ # This property is only set for composed archives.
41
+ #
36
42
  # @attr [string] session_id
37
43
  # The session ID of the OpenTok session associated with this archive.
38
44
  #
39
45
  # @attr [float] size
40
46
  # The size of the MP4 file. For archives that have not been generated, this value is set to 0.
41
47
  #
48
+ # @attr [string] streamMode
49
+ # Whether streams included in the archive are selected automatically ("auto", the default) or manually ("manual").
50
+ #
42
51
  # @attr [string] status
43
52
  # The status of the archive, which can be one of the following:
44
53
  #
@@ -63,12 +72,13 @@ module OpenTok
63
72
  # set to null. The download URL is obfuscated, and the file is only available from the URL for
64
73
  # 10 minutes. To generate a new URL, call the Archive.listArchives() or OpenTok.getArchive() method.
65
74
  class Archive
66
-
75
+ attr_reader :multi_archive_tag
67
76
  # @private
68
77
  def initialize(interface, json)
69
78
  @interface = interface
70
79
  # TODO: validate json fits schema
71
80
  @json = json
81
+ @multi_archive_tag = @json['multiArchiveTag']
72
82
  end
73
83
 
74
84
  # A JSON-encoded string representation of the archive.
@@ -99,7 +109,7 @@ module OpenTok
99
109
  # {https://tokbox.com/developer/guides/archiving/layout-control.html Customizing
100
110
  # the video layout for composed archives}.
101
111
  #
102
- # @option options [String] :type
112
+ # @option options [String] :type
103
113
  # The layout type. Set this to "bestFit", "pip", "verticalPresentation",
104
114
  # "horizontalPresentation", "focus", or "custom".
105
115
  #
@@ -136,6 +146,46 @@ module OpenTok
136
146
  @json = @interface.layout(@json['id'], opts)
137
147
  end
138
148
 
149
+ # Adds a stream to currently running composed archive that was started with the
150
+ # streamMode set to "manual". For a description of the feature, see
151
+ # {https://tokbox.com/developer/rest/#selecting-archive-streams}.
152
+ #
153
+ # @param [String] stream_id
154
+ # The ID for the stream to be added to the archive
155
+ #
156
+ # @option opts [true, false] :has_audio
157
+ # (Boolean, optional) — Whether the composed archive should include the stream's
158
+ # audio (true, the default) or not (false).
159
+ #
160
+ # @option opts [true, false] :has_video
161
+ # (Boolean, optional) — Whether the composed archive should include the stream's
162
+ # video (true, the default) or not (false).
163
+ #
164
+ # @raise [OpenTokArchiveError]
165
+ # The streamMode for the archive is not set to "manual".
166
+ #
167
+ # You can call the method repeatedly with add_stream set to the same stream ID, to
168
+ # toggle the stream's audio or video in the archive. If you set both has_audio and
169
+ # has_video to false, you will get error response.
170
+ def add_stream(stream_id, opts = {})
171
+ raise OpenTokArchiveError, "stream_mode must be manual in order to add a stream" unless @json['streamMode'] == 'manual'
172
+ @interface.add_stream(@json['id'], stream_id, opts)
173
+ end
174
+
175
+ # Removes a stream to currently running composed archive that was started with the
176
+ # streamMode set to "manual". For a description of the feature, see
177
+ # {https://tokbox.com/developer/rest/#selecting-archive-streams}.
178
+ #
179
+ # @param [String] stream_id
180
+ # The ID for the stream to be removed from the archive
181
+ #
182
+ # @raise [OpenTokArchiveError]
183
+ # The streamMode for the archive is not set to "manual".
184
+ def remove_stream(stream_id)
185
+ raise OpenTokArchiveError, "stream_mode must be manual in order to remove a stream" unless @json['streamMode'] == 'manual'
186
+ @interface.remove_stream(@json['id'], stream_id)
187
+ end
188
+
139
189
  # @private ignore
140
190
  def method_missing(method, *args, &block)
141
191
  camelized_method = method.to_s.camelize(:lower)