opentok 3.1.0 → 4.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/metrics.yml +17 -0
  3. data/.travis.yml +3 -1
  4. data/CODE_OF_CONDUCT.md +128 -0
  5. data/README.md +98 -49
  6. data/lib/opentok/archives.rb +13 -2
  7. data/lib/opentok/broadcasts.rb +1 -1
  8. data/lib/opentok/client.rb +6 -4
  9. data/lib/opentok/constants.rb +1 -1
  10. data/lib/opentok/opentok.rb +4 -2
  11. data/lib/opentok/sip.rb +0 -2
  12. data/lib/opentok/version.rb +1 -1
  13. data/opentok.gemspec +9 -8
  14. data/sample/Broadcast/Gemfile +4 -0
  15. data/sample/Broadcast/README.md +201 -0
  16. data/sample/Broadcast/broadcast_sample.rb +97 -0
  17. data/sample/Broadcast/public/css/sample.css +64 -0
  18. data/sample/Broadcast/public/js/host.js +185 -0
  19. data/sample/Broadcast/public/js/participant.js +85 -0
  20. data/sample/Broadcast/views/host.erb +82 -0
  21. data/sample/Broadcast/views/index.erb +32 -0
  22. data/sample/Broadcast/views/layout.erb +29 -0
  23. data/sample/Broadcast/views/participant.erb +27 -0
  24. data/sample/HelloWorld/public/js/helloworld.js +4 -10
  25. data/sample/HelloWorld/views/index.erb +1 -3
  26. data/spec/cassettes/OpenTok_Archives/calls_layout_on_archive_object.yml +3 -1
  27. data/spec/cassettes/OpenTok_Archives/changes_the_layout_of_an_archive.yml +3 -1
  28. data/spec/cassettes/OpenTok_Archives/http_client_errors/.yml +34 -0
  29. data/spec/cassettes/OpenTok_Archives/should_create_archives.yml +3 -1
  30. data/spec/cassettes/OpenTok_Archives/should_create_audio_only_archives.yml +3 -1
  31. data/spec/cassettes/OpenTok_Archives/should_create_custom_layout_archives.yml +50 -0
  32. data/spec/cassettes/OpenTok_Archives/should_create_hd_archives.yml +3 -1
  33. data/spec/cassettes/OpenTok_Archives/should_create_individual_archives.yml +3 -1
  34. data/spec/cassettes/OpenTok_Archives/should_create_named_archives.yml +3 -1
  35. data/spec/cassettes/OpenTok_Archives/should_delete_an_archive_by_id.yml +3 -1
  36. data/spec/cassettes/OpenTok_Archives/should_find_archives_by_id.yml +3 -1
  37. data/spec/cassettes/OpenTok_Archives/should_find_archives_with_unknown_properties.yml +3 -1
  38. data/spec/cassettes/OpenTok_Archives/should_find_expired_archives.yml +3 -1
  39. data/spec/cassettes/OpenTok_Archives/should_find_paused_archives_by_id.yml +3 -1
  40. data/spec/cassettes/OpenTok_Archives/should_stop_archives.yml +3 -1
  41. data/spec/cassettes/OpenTok_Archives/when_many_archives_are_created/should_return_all_archives.yml +3 -1
  42. data/spec/cassettes/OpenTok_Archives/when_many_archives_are_created/should_return_archives_with_an_offset.yml +3 -1
  43. data/spec/cassettes/OpenTok_Archives/when_many_archives_are_created/should_return_count_number_of_archives.yml +3 -1
  44. data/spec/cassettes/OpenTok_Archives/when_many_archives_are_created/should_return_part_of_the_archives_when_using_offset_and_count.yml +3 -1
  45. data/spec/cassettes/OpenTok_Archives/when_many_archives_are_created/should_return_session_archives.yml +3 -1
  46. data/spec/cassettes/OpenTok_Broadcasts/calls_layout_on_broadcast_object.yml +3 -1
  47. data/spec/cassettes/OpenTok_Broadcasts/changes_the_layout_of_a_broadcast.yml +3 -1
  48. data/spec/cassettes/OpenTok_Broadcasts/fetches_a_hls_broadcast_url.yml +3 -1
  49. data/spec/cassettes/OpenTok_Broadcasts/finds_a_broadcast.yml +3 -1
  50. data/spec/cassettes/OpenTok_Broadcasts/starts_a_rtmp_broadcast.yml +3 -1
  51. data/spec/cassettes/OpenTok_Broadcasts/stops_a_broadcast.yml +3 -1
  52. data/spec/cassettes/OpenTok_Connections/forces_a_connection_to_be_terminated.yml +3 -1
  53. data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_always_archived_sessions.yml +3 -1
  54. data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_default_sessions.yml +3 -1
  55. data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_relayed_media_sessions.yml +3 -1
  56. data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_relayed_media_sessions_for_invalid_media_modes.yml +3 -1
  57. data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_relayed_media_sessions_with_a_location_hint.yml +3 -1
  58. data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_routed_media_sessions.yml +3 -1
  59. data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_routed_media_sessions_with_a_location_hint.yml +3 -1
  60. data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_sessions_with_a_location_hint.yml +3 -1
  61. data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/with_an_addendum_to_the_user_agent_string/should_append_the_addendum_to_the_user_agent_header.yml +3 -1
  62. data/spec/cassettes/OpenTok_Signals/receives_a_valid_response_for_a_connection.yml +3 -1
  63. data/spec/cassettes/OpenTok_Signals/receives_a_valid_response_for_all_connections.yml +3 -1
  64. data/spec/cassettes/OpenTok_Sip/receives_a_valid_response.yml +3 -1
  65. data/spec/cassettes/OpenTok_Streams/get_all_streams_information.yml +3 -1
  66. data/spec/cassettes/OpenTok_Streams/get_specific_stream_information.yml +3 -1
  67. data/spec/cassettes/OpenTok_Streams/layout_working_on_two_stream_list.yml +3 -1
  68. data/spec/opentok/archives_spec.rb +11 -1
  69. data/spec/opentok/broadcasts_spec.rb +25 -1
  70. data/spec/opentok/client_spec.rb +51 -0
  71. data/spec/opentok/opentok_spec.rb +21 -0
  72. data/spec/spec_helper.rb +2 -0
  73. metadata +39 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4baddcff5e72cad62caf5c0046c8a2eb3cc375b3
4
- data.tar.gz: 59b84a91a65d5841f76f4251a26ea99739386117
2
+ SHA256:
3
+ metadata.gz: 74581fd2fb2645cd163ed9a979fcfbb8cfd13da7cf0530bd49364a8a63ce0164
4
+ data.tar.gz: 8a21fb081a3be5c24a3a321442af11a56ef960ea489b1482abd876adc4d09e44
5
5
  SHA512:
6
- metadata.gz: 5bdaf9b065a6e5449b9753d42e3fd906e9afa66635d71b74ae0f2965bc34e138de2a253f4707d0bbbe3fe972584db3f9f235129c55ec1dfb09b4669ef2de0eb1
7
- data.tar.gz: ad070ca9e3e516b96c9cbd8aff45ccd9b1f593f657688f8b1c90894c1b72bcb5c9dc53ccea0d19c7ef7d813951645709a6daa3855362625bd3e976be87118f80
6
+ metadata.gz: dfbddec4e8e490a017817e05a1ec9c14b51b655a15f263ab15b2d461118330b34fb1296f8e614d76bbf480893856ad2b0d6202175de786499bbce001d5ce5943
7
+ data.tar.gz: 3cc40c6ba443524d7470ee2d331fe20cfb7f86b69067b56d22f957d2d01715334faa668d2e5121062cb5f393503924ce8cb73c5fe8be523cb1b1968d17ebaa2e
@@ -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 }}
@@ -5,11 +5,13 @@ language: ruby
5
5
  cache: bundler
6
6
  before_install: gem update bundler
7
7
  rvm:
8
- - 2.0
9
8
  - 2.1
10
9
  - 2.2
11
10
  - 2.3
12
11
  - 2.4
12
+ - 2.5
13
+ - 2.6
14
+ - 2.7
13
15
  notifications:
14
16
  slack:
15
17
  secure: agVll2R9PTPvJMcUgbvOh9eGt60zGDc8kPUwEsiQr828rCgXh/ZxD5irYDyKQg3ZsS8+f3MjFCwzU7uQALkia2pDrie9d8g8m1dt4Q5U7Qm6QecshvE0U9JwbB5Ngxaftbqyf0XEFrE7CKs7RI1BzFRpe8m+fdZgfwccX8Gb7pc=
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ - Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ - The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ - Trolling, insulting or derogatory comments, and personal or political attacks
33
+ - Public or private harassment
34
+ - Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ - Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ devrel@vonage.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
data/README.md CHANGED
@@ -1,6 +1,8 @@
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)
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)
4
+
5
+ <img src="https://assets.tokbox.com/img/vonage/Vonage_VideoAPI_black.svg" height="48px" alt="Tokbox is now known as Vonage" />
4
6
 
5
7
  The OpenTok Ruby SDK lets you generate
6
8
  [sessions](https://tokbox.com/developer/guides/create-session/) and
@@ -21,7 +23,7 @@ Bundler helps manage dependencies for Ruby projects. Find more info here:
21
23
  Add this gem to your `Gemfile`:
22
24
 
23
25
  ```ruby
24
- gem "opentok", "~> 3.1.0"
26
+ gem "opentok", "~> 4.0.0"
25
27
  ```
26
28
 
27
29
  Allow bundler to install the change.
@@ -49,18 +51,32 @@ require "opentok"
49
51
  opentok = OpenTok::OpenTok.new api_key, api_secret
50
52
  ```
51
53
 
54
+ ### Initialization Options
55
+
56
+ You can specify a custom timeout value for HTTP requests when initializing a new `OpenTok::OpenTok`
57
+ object:
58
+
59
+ ```ruby
60
+ require "opentok"
61
+
62
+ opentok = OpenTok::OpenTok.new api_key, api_secret, :timeout_length => 10
63
+ ```
64
+
65
+ The value for `:timeout_length` is an integer representing the number of seconds to wait for an HTTP
66
+ request to complete. The default is set to 2 seconds.
67
+
52
68
  ## Creating Sessions
53
69
 
54
70
  To create an OpenTok Session, use the `OpenTok#create_session(properties)` method.
55
71
  The `properties` parameter is an optional Hash used to specify the following:
56
72
 
57
- * Whether the session uses the [OpenTok Media
73
+ - Whether the session uses the [OpenTok Media
58
74
  Router](https://tokbox.com/developer/guides/create-session/#media-mode),
59
75
  which is required for some OpenTok features (such as archiving)
60
76
 
61
- * A location hint for the OpenTok server.
77
+ - A location hint for the OpenTok server.
62
78
 
63
- * Whether the session is automatically archived.
79
+ - Whether the session is automatically archived.
64
80
 
65
81
  The `session_id` method of the returned `OpenTok::Session` instance is useful to
66
82
  get a sessionId that can be saved to a persistent store (such as a database).
@@ -108,11 +124,11 @@ token = session.generate_token({
108
124
  });
109
125
  ```
110
126
 
111
- ## Working with Streams
127
+ ## Working with Streams
112
128
 
113
129
  Use this method to get information for an OpenTok stream or for all streams in a session.
114
130
  For example, you can call this method to get information about layout classes used by an
115
- OpenTok stream.
131
+ OpenTok stream.
116
132
 
117
133
  To get information of a specific stream in a session, call
118
134
  `opentok.streams.find(session_id, stream_id)`. The return object is a `Stream` object and
@@ -139,8 +155,7 @@ expect(all_streams[0].layoutClassList[1]).to eq "focus"
139
155
  You can only archive sessions that use the OpenTok Media Router
140
156
  (sessions with the media mode set to routed).
141
157
 
142
- You can start the recording of an OpenTok Session using the `opentok.archives.create(session_id,
143
- options)` method. This will return an `OpenTok::Archive` instance. The parameter `options` is an
158
+ You can start the recording of an OpenTok Session using the `opentok.archives.create(session_id, options)` method. This will return an `OpenTok::Archive` instance. The parameter `options` is an
144
159
  optional Hash used to set the `has_audio`, `has_video`, and `name` options. Note that you can
145
160
  only start an Archive on a Session that has clients connected.
146
161
 
@@ -170,7 +185,7 @@ recorded to a single (composed) file.
170
185
 
171
186
  For composed archives you can set the resolution of the archive, either "640x480" (SD, the default)
172
187
  or "1280x720" (HD). The `resolution` parameter is optional and could be included in the options
173
- hash (second argument) of the `opentok.archives.create()` method.
188
+ hash (second argument) of the `opentok.archives.create()` method.
174
189
 
175
190
  ```ruby
176
191
  opts = {
@@ -181,6 +196,30 @@ opts = {
181
196
  archive = opentok.archives.create session_id, opts
182
197
  ```
183
198
 
199
+ To customize the initial layout of composed archives, you can use the `:layout` option.
200
+ Set this to a hash containing two keys: `:type` and `:stylesheet`. Valid values for
201
+ `:type` are "bestFit" (best fit), "custom" (custom), "horizontalPresentation"
202
+ (horizontal presentation), "pip" (picture-in-picture), and "verticalPresentation"
203
+ (vertical presentation)). If you specify a "custom" layout type, set the `:stylesheet`
204
+ key to the stylesheet (CSS). (For other layout types, do not set the `:stylesheet` key.)
205
+
206
+ ```ruby
207
+ opts = {
208
+ :output_mode => :composed,
209
+ :resolution => "1280x720",
210
+ :layout => {
211
+ :type => "custom",
212
+ :stylesheet => "stream:last-child{display: block;margin: 0;top: 0;left: 0;width: 1px;height: 1px;}stream:first-child{display: block;margin: 0;top: 0;left: 0;width: 100%;height: 100%;}"
213
+ }
214
+ }
215
+
216
+ archive = opentok.archives.create session_id, opts
217
+ ```
218
+
219
+ If you do not specify an initial layout type, the archive uses the best fit
220
+ layout type. For more information, see [Customizing the video layout for composed
221
+ archives](https://tokbox.com/developer/guides/archiving/layout-control.html).
222
+
184
223
  You can stop the recording of a started Archive using the `opentok.archives.stop_by_id(archive_id)`
185
224
  method. You can also do this using the `Archive#stop()` method.
186
225
 
@@ -238,15 +277,15 @@ opentok.archives.layout(archive_id, opts)
238
277
 
239
278
  The hash `opts` has two entries:
240
279
 
241
- * The `type` is the layout type for the archive. Valid values are "bestFit" (best fit)
280
+ - The `type` is the layout type for the archive. Valid values are "bestFit" (best fit)
242
281
  "custom" (custom), "horizontalPresentation" (horizontal presentation),
243
282
  "pip" (picture-in-picture), and "verticalPresentation" (vertical presentation)).
244
283
 
245
- * If you specify a "custom" layout type, set the `stylesheet` property.
246
- (For other layout types, do not set the stylesheet property.)
284
+ - If you specify a "custom" layout type, set the `stylesheet` property.
285
+ (For other layout types, do not set the stylesheet property.)
247
286
 
248
287
  See [Customizing the video layout for composed archives](https://tokbox.com/developer/guides/archiving/layout-control.html)
249
- for more details.
288
+ for more details.
250
289
 
251
290
  You can set the initial layout class for a client's streams by setting the layout option when you
252
291
  create the token for the client, using the `opentok.generate_token` method. And you can also change
@@ -272,7 +311,7 @@ For more information on setting stream layout classes, see the
272
311
  [Changing the composed archive layout classes for an OpenTok
273
312
  stream](https://tokbox.com/developer/rest/#change-stream-layout-classes-composed).
274
313
 
275
- Please keep in mind that the `streams.layout` method applies to archive and broadcast streams only.
314
+ Please keep in mind that the `streams.layout` method applies to archive and broadcast streams only.
276
315
 
277
316
  For more information on archiving, see the
278
317
  [OpenTok archiving](https://tokbox.com/opentok/tutorials/archiving/) programming guide.
@@ -281,7 +320,7 @@ For more information on archiving, see the
281
320
 
282
321
  You can send a signal using the `opentok.signals.send(session_id, connection_id, opts)` method.
283
322
  If `connection_id` is nil or an empty string, then the signal is send to all valid connections in
284
- the session.
323
+ the session.
285
324
 
286
325
  An example of `opts` field can be as follows:
287
326
 
@@ -292,11 +331,11 @@ opts = { :type => "chat",
292
331
  ```
293
332
 
294
333
  The maximum length of the `type` string is 128 bytes, and it must contain only letters
295
- (A-Z and a-z), numbers (0-9), '-', '_', and '~'.
334
+ (A-Z and a-z), numbers (0-9), '-', '\_', and '~'.
296
335
 
297
336
  The `data` string must not exceed the maximum size (8 kB).
298
337
 
299
- The `connection_id` and `opts` parameter are jointly optional by default. Hence you can also
338
+ The `connection_id` and `opts` parameter are jointly optional by default. Hence you can also
300
339
  use `opentok.signals.send(session_id)`
301
340
 
302
341
  For more information on signaling, see the
@@ -310,16 +349,17 @@ To successfully start broadcasting a session, at least one publishing client mus
310
349
  the session.
311
350
 
312
351
  You can only have one active live streaming broadcast at a time for a session (however, having more
313
- than one would not be useful).
352
+ than one would not be useful).
314
353
 
315
354
  The live streaming broadcast can target one HLS endpoint and up to five RTMP servers simultaneously
316
- for a session.
355
+ for a session.
317
356
 
318
357
  You can only start live streaming for sessions that use the OpenTok Media Router (with the
319
358
  media mode set to routed). You cannot use live streaming with sessions that have the media mode set
320
359
  to relayed.
321
360
 
322
361
  To create a HLS only broadcast:
362
+
323
363
  ```ruby
324
364
  opts = {
325
365
  :outputs => {
@@ -345,43 +385,45 @@ broadcast = opentok.broadcasts.create(session_id, opts)
345
385
  ```
346
386
 
347
387
  The returned Broadcast object has information about the broadcast, like id, sessionId , projectId,
348
- createdAt, updatedAt, resolution, status, and a Hash of broadcastUrls. The broadcastUrls
388
+ createdAt, updatedAt, resolution, status, and a Hash of broadcastUrls. The broadcastUrls
349
389
  consists of an HLS URL and an array of RTMP objects. The RTMP objects resembles the `rtmp` value
350
- in `opts` in the example above.
390
+ in `opts` in the example above.
351
391
 
352
392
  For more information on broadcast, see the
353
393
  [OpenTok Broadcast guide](https://tokbox.com/developer/rest/#start_broadcast) programming guide.
354
394
 
355
- To get information about a broadcast stream
395
+ To get information about a broadcast stream
396
+
356
397
  ```ruby
357
398
  my_broadcast = opentok.broadcasts.find broadcast_id
358
399
  ```
400
+
359
401
  The Broadcast object returned has properties describing the broadcast, like id, sessionId,
360
- projectId, createdAt, updatedAt, resolution, status, and a Hash of broadcastUrls. The broadcastUrls
402
+ projectId, createdAt, updatedAt, resolution, status, and a Hash of broadcastUrls. The broadcastUrls
361
403
  consists of an HLS URL and an array of RTMP objects. The RTMP objects resembles the `rtmp` value
362
- in `opts` in the example above.
404
+ in `opts` in the example above.
363
405
 
364
406
  To stop a broadcast:
365
407
 
366
408
  ```ruby
367
409
  my_broadcast = opentok.broadcasts.stop broadcast_id
368
-
410
+
369
411
  # stop at a broadcast object level too
370
- #
412
+ #
371
413
  my_broadcast = opentok.broadcasts.find broadcast_id
372
414
  ret_broadcast = my_broadcast.stop
373
-
374
- # Both the above returned objects has the "broadcastUrls" property as a nil value and the status
415
+
416
+ # Both the above returned objects has the "broadcastUrls" property as a nil value and the status
375
417
  # property value is "stopped"
376
418
  ```
377
419
 
420
+ To change the layout of a broadcast dynamically
378
421
 
379
- To change the layout of a broadcast dynamically
380
422
  ```ruby
381
423
  opentok.broadcasts.layout(started_broadcast_id, {
382
424
  :type => "verticalPresentation"
383
425
  })
384
-
426
+
385
427
  # On an object level
386
428
  my_broadcast = opentok.broadcasts.find broadcast_id
387
429
  my_broadcast.layout(
@@ -393,28 +435,28 @@ opentok.broadcasts.layout(started_broadcast_id, {
393
435
 
394
436
  The hash above has two entries.
395
437
 
396
- * The `type` is the layout type for the archive. Valid values are "bestFit" (best fit),
438
+ - The `type` is the layout type for the archive. Valid values are "bestFit" (best fit),
397
439
  "custom" (custom), "horizontalPresentation" (horizontal presentation),
398
- "pip" (picture-in-picture), and "verticalPresentation" (vertical presentation).
440
+ "pip" (picture-in-picture), and "verticalPresentation" (vertical presentation).
399
441
 
400
- * If you specify a "custom" layout type, set the `stylesheet` property. (For other layout types,
401
- do not set the stylesheet property.)
442
+ - If you specify a "custom" layout type, set the `stylesheet` property. (For other layout types,
443
+ do not set the stylesheet property.)
402
444
 
403
445
  Refer to [Customizing the video layout for composed
404
446
  archives](https://tokbox.com/developer/guides/archiving/layout-control.html)
405
- for more details.
447
+ for more details.
406
448
 
407
449
  You can also change the layout of an individual stream dynamically. Refer to
408
450
  [working with Streams](#working-with-streams).
409
451
 
410
- ## Force disconnect
452
+ ## Force disconnect
411
453
 
412
454
  You can cause a client to be forced to disconnect from a session by using the
413
455
  `opentok.connections.forceDisconnect(session_id, connection_id)` method.
414
456
 
415
457
  ## Initiating a SIP call
416
458
 
417
- You can initiate a SIP call using the `opentok.sip.dial(session_id, token, sip_uri, opts)` method.
459
+ You can initiate a SIP call using the `opentok.sip.dial(session_id, token, sip_uri, opts)` method.
418
460
  This requires a SIP URL. You will often need to pass options for authenticating to the SIP provider
419
461
  and specifying encrypted session establishment.
420
462
 
@@ -429,14 +471,14 @@ response = opentok.sip.dial(session_id, token, "sip:+15128675309@acme.pstn.examp
429
471
  For more information on SIP Interconnect, see the
430
472
  [OpenTok SIP Interconnect](https://tokbox.com/developer/guides/sip/) developer guide.
431
473
 
432
-
433
474
  # Samples
434
475
 
435
- There are two sample applications included in this repository. To get going as fast as possible, clone the whole
436
- repository and follow the Walkthroughs:
476
+ There are three sample applications included in this repository. To get going as fast as possible, clone the whole
477
+ repository and read the README in each of the sample directories:
437
478
 
438
- * [HelloWorld](sample/HelloWorld/README.md)
439
- * [Archiving](sample/Archiving/README.md)
479
+ - [HelloWorld](sample/HelloWorld/README.md)
480
+ - [Archiving](sample/Archiving/README.md)
481
+ - [Broadcast](sample/Broadcast/README.md)
440
482
 
441
483
  # Documentation
442
484
 
@@ -447,7 +489,7 @@ Reference documentation is available at
447
489
  You need an OpenTok API key and API secret, which you can obtain by logging into your
448
490
  [TokBox account](https://tokbox.com/account).
449
491
 
450
- The OpenTok Ruby SDK requires Ruby 1.9.3 or greater.
492
+ The OpenTok Ruby SDK requires Ruby 2.1.0 or greater.
451
493
 
452
494
  # Release Notes
453
495
 
@@ -456,6 +498,12 @@ about each release.
456
498
 
457
499
  ## Important changes since v2.2.0
458
500
 
501
+ **Changes in v4.0.0:**
502
+
503
+ The SDK adds support for Ruby v2.7 and now requires Ruby v2.1.0 or higher.
504
+ For Ruby v2.0.0 please continue to use the OpenTok Ruby SDK v3.0.0.
505
+ For Ruby v1.9.3 please continue to use the OpenTok Ruby SDK v2.5.0.
506
+
459
507
  **Changes in v3.0.0:**
460
508
 
461
509
  The SDK now now requires Ruby v2.0.0 or higher. For Ruby v1.9.3 please continue to use the
@@ -480,15 +528,16 @@ See the reference documentation
480
528
  <http://www.tokbox.com/opentok/libraries/server/ruby/reference/index.html> and in the
481
529
  docs directory of the SDK.
482
530
 
483
-
484
531
  # Development and Contributing
485
532
 
486
533
  Interested in contributing? We :heart: pull requests! See the [Development](DEVELOPING.md) and
487
534
  [Contribution](CONTRIBUTING.md) guidelines.
488
535
 
489
- # Support
536
+ ## Getting Help
490
537
 
491
- See <https://support.tokbox.com> for all our support options.
538
+ We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:
492
539
 
493
- Find a bug? File it on the [Issues](https://github.com/opentok/opentok-ruby-sdk/issues) page. Hint:
494
- test cases are really helpful!
540
+ - Open an issue on this repository
541
+ - See <https://support.tokbox.com/> for support options
542
+ - Tweet at us! We're [@VonageDev on Twitter](https://twitter.com/VonageDev)
543
+ - Or [join the Vonage Developer Community Slack](https://developer.nexmo.com/community/slack)