Skip to content

Commit 47009ca

Browse files
authored
Merge pull request #252 from opentok/dev
Version 4.5.0
2 parents 5609262 + 56dcf13 commit 47009ca

31 files changed

+1339
-54
lines changed

CHANGES.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 4.5.0
2+
3+
* Adds support for multiple archives and records feature [#248](https://github.com/opentok/OpenTok-Ruby-SDK/pull/248)
4+
* Adds Experience Composer functionality [#249](https://github.com/opentok/OpenTok-Ruby-SDK/pull/249)
5+
* Updates code comments to make explicit support for 1080p resolution for Archive and Broadcast [#246](https://github.com/opentok/OpenTok-Ruby-SDK/pull/246)
6+
* Updates various other documentation/code comments [#250](https://github.com/opentok/OpenTok-Ruby-SDK/pull/250)
7+
18
# 4.4.0
29

310
* Implements DVR Pause/Resume and HLS Low-Latency options for Broadcasts [#243](https://github.com/opentok/OpenTok-Ruby-SDK/pull/243)

README.md

+59-37
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
# OpenTok Ruby SDK
22

33
![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)
4+
[![codecov](https://codecov.io/gh/opentok/OpenTok-Ruby-SDK/branch/master/graph/badge.svg)](https://codecov.io/gh/opentok/opentok-ruby-sdk)
55
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
66

77
<img src="https://assets.tokbox.com/img/vonage/Vonage_VideoAPI_black.svg" height="48px" alt="Tokbox is now known as Vonage" />
88

9-
The OpenTok Ruby SDK lets you generate
10-
[sessions](https://tokbox.com/developer/guides/create-session/) and
11-
[tokens](https://tokbox.com/developer/guides/create-token/) for
12-
[OpenTok](http://www.tokbox.com/) applications. It also includes methods for
13-
working with OpenTok [archives](https://tokbox.com/developer/guides/archiving),
14-
working with OpenTok [live streaming
15-
broadcasts](https://tokbox.com/developer/guides/broadcast/live-streaming/),
16-
working with OpenTok [SIP interconnect](https://tokbox.com/developer/guides/sip),
17-
and [disconnecting clients from sessions](https://tokbox.com/developer/guides/moderation/rest/).
9+
The OpenTok Ruby SDK provides methods for:
1810

19-
# 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)
2021

21-
## Bundler (recommended):
22+
## Installation
23+
24+
### Bundler (recommended):
2225

2326
Bundler helps manage dependencies for Ruby projects. Find more info here: <http://bundler.io>
2427

@@ -34,15 +37,15 @@ Allow bundler to install the change.
3437
$ bundle install
3538
```
3639

37-
## RubyGems:
40+
### RubyGems:
3841

3942
```
4043
$ gem install opentok
4144
```
4245

43-
# Usage
46+
## Usage
4447

45-
## Initializing
48+
### Initializing
4649

4750
Load the gem at the top of any file where it will be used. Then initialize an `OpenTok::OpenTok`
4851
object with your OpenTok API key and API secret.
@@ -53,7 +56,7 @@ require "opentok"
5356
opentok = OpenTok::OpenTok.new api_key, api_secret
5457
```
5558

56-
### Initialization Options
59+
#### Initialization Options
5760

5861
You can specify a custom timeout value for HTTP requests when initializing a new `OpenTok::OpenTok`
5962
object:
@@ -67,7 +70,7 @@ opentok = OpenTok::OpenTok.new api_key, api_secret, :timeout_length => 10
6770
The value for `:timeout_length` is an integer representing the number of seconds to wait for an HTTP
6871
request to complete. The default is set to 2 seconds.
6972

70-
## Creating Sessions
73+
### Creating Sessions
7174

7275
To create an OpenTok Session, use the `OpenTok#create_session(properties)` method.
7376
The `properties` parameter is an optional Hash used to specify the following:
@@ -101,7 +104,7 @@ session = opentok.create_session :archive_mode => :always, :media_mode => :route
101104
session_id = session.session_id
102105
```
103106

104-
## Generating Tokens
107+
### Generating Tokens
105108

106109
Once a Session is created, you can start generating Tokens for clients to use when connecting to it.
107110
You can generate a token either by calling the `opentok.generate_token(session_id, options)` method,
@@ -111,7 +114,7 @@ the Token. For layout control in archives and broadcasts, the initial layout cla
111114
published from connections using this token can be set as well.
112115

113116
```ruby
114-
# 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)
115118
token = opentok.generate_token session_id
116119

117120
# Generate a Token by calling the method on the Session (returned from createSession)
@@ -126,7 +129,7 @@ token = session.generate_token({
126129
});
127130
```
128131

129-
## Working with Streams
132+
### Working with Streams
130133

131134
Use this method to get information for an OpenTok stream or for all streams in a session.
132135
For example, you can call this method to get information about layout classes used by an
@@ -152,7 +155,7 @@ expect(all_streams.total).to eq 2
152155
expect(all_streams[0].layoutClassList[1]).to eq "focus"
153156
```
154157

155-
## Working with Archives
158+
### Working with Archives
156159

157160
You can only archive sessions that use the OpenTok Media Router
158161
(sessions with the media mode set to routed).
@@ -185,8 +188,7 @@ archive = opentok.archives.create session_id :output_mode => :individual
185188
The `:output_mode => :composed` setting (the default) causes all streams in the archive to be
186189
recorded to a single (composed) file.
187190

188-
For composed archives you can set the resolution of the archive, either "640x480" (SD, the default)
189-
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
190192
hash (second argument) of the `opentok.archives.create()` method.
191193

192194
```ruby
@@ -316,9 +318,9 @@ stream](https://tokbox.com/developer/rest/#change-stream-layout-classes-composed
316318
Please keep in mind that the `streams.layout` method applies to archive and broadcast streams only.
317319

318320
For more information on archiving, see the
319-
[OpenTok archiving](https://tokbox.com/opentok/tutorials/archiving/) programming guide.
321+
[OpenTok archiving](/developer/guides/archiving/) developer guide.
320322

321-
## Signaling
323+
### Signaling
322324

323325
You can send a signal using the `opentok.signals.send(session_id, connection_id, opts)` method.
324326
If `connection_id` is nil or an empty string, then the signal is send to all valid connections in
@@ -343,16 +345,13 @@ use `opentok.signals.send(session_id)`
343345
For more information on signaling, see the
344346
[OpenTok Signaling](https://tokbox.com/developer/guides/signaling/js/) programming guide.
345347

346-
## Broadcasting
348+
### Broadcasting
347349

348350
You can broadcast your streams to a HLS or RTMP servers.
349351

350352
To successfully start broadcasting a session, at least one publishing client must be connected to
351353
the session.
352354

353-
You can only have one active live streaming broadcast at a time for a session (however, having more
354-
than one would not be useful).
355-
356355
The live streaming broadcast can target one HLS endpoint and up to five RTMP servers simultaneously
357356
for a session.
358357

@@ -451,12 +450,25 @@ for more details.
451450
You can also change the layout of an individual stream dynamically. Refer to
452451
[working with Streams](#working-with-streams).
453452

454-
## Force disconnect
453+
### Force disconnect
455454

456455
You can cause a client to be forced to disconnect from a session by using the
457456
`opentok.connections.forceDisconnect(session_id, connection_id)` method.
458457

459-
## 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
460472

461473
You can initiate a SIP call using the `opentok.sip.dial(session_id, token, sip_uri, opts)` method.
462474
This requires a SIP URL. You will often need to pass options for authenticating to the SIP provider
@@ -473,7 +485,17 @@ response = opentok.sip.dial(session_id, token, "sip:[email protected]
473485
For more information on SIP Interconnect, see the
474486
[OpenTok SIP Interconnect](https://tokbox.com/developer/guides/sip/) developer guide.
475487

476-
# 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
477499

478500
There are three sample applications included in this repository. To get going as fast as possible, clone the whole
479501
repository and read the README in each of the sample directories:
@@ -482,23 +504,23 @@ repository and read the README in each of the sample directories:
482504
- [Archiving](sample/Archiving/README.md)
483505
- [Broadcast](sample/Broadcast/README.md)
484506

485-
# Documentation
507+
## Documentation
486508

487509
Reference documentation is available at <http://www.tokbox.com//opentok/libraries/server/ruby/reference/index.html>.
488510

489-
# Requirements
511+
## Requirements
490512

491513
You need an OpenTok API key and API secret, which you can obtain by logging into your
492514
[Vonage Video API account](https://tokbox.com/account).
493515

494516
The OpenTok Ruby SDK requires Ruby 2.1.0 or greater.
495517

496-
# Release Notes
518+
## Release Notes
497519

498520
See the [Releases](https://github.com/opentok/opentok-ruby-sdk/releases) page for details
499521
about each release.
500522

501-
## Important changes since v2.2.0
523+
### Important changes since v2.2.0
502524

503525
**Changes in v4.0.0:**
504526

@@ -530,7 +552,7 @@ See the reference documentation
530552
<http://www.tokbox.com/opentok/libraries/server/ruby/reference/index.html> and in the
531553
docs directory of the SDK.
532554

533-
# Development and Contributing
555+
## Development and Contributing
534556

535557
Interested in contributing? We :heart: pull requests! See the [Development](DEVELOPING.md) and
536558
[Contribution](CONTRIBUTING.md) guidelines.

lib/opentok/archive.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ module OpenTok
3434
# reason the archive stopped (such as "maximum duration exceeded") or failed.
3535
#
3636
# @attr [string] resolution
37-
# The resolution of the archive (either "640x480", "1280x720", "480x640", or "720x1280").
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).
3840
# This property is only set for composed archives.
3941
#
4042
# @attr [string] session_id
@@ -70,12 +72,13 @@ module OpenTok
7072
# set to null. The download URL is obfuscated, and the file is only available from the URL for
7173
# 10 minutes. To generate a new URL, call the Archive.listArchives() or OpenTok.getArchive() method.
7274
class Archive
73-
75+
attr_reader :multi_archive_tag
7476
# @private
7577
def initialize(interface, json)
7678
@interface = interface
7779
# TODO: validate json fits schema
7880
@json = json
81+
@multi_archive_tag = @json['multiArchiveTag']
7982
end
8083

8184
# A JSON-encoded string representation of the archive.

lib/opentok/archives.rb

+13-5
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,28 @@ def initialize(client)
3939
# (a video track is included). If you set both <code>has_audio</code> and
4040
# <code>has_video</code> to <code>false</code>, the call to the <code>create()</code>
4141
# method results in an error.
42+
# @option options [String] :multiArchiveTag (Optional) Set this to support recording multiple archives for the same session simultaneously.
43+
# Set this to a unique string for each simultaneous archive of an ongoing session. You must also set this option when manually starting an archive
44+
# that is {https://tokbox.com/developer/guides/archiving/#automatic automatically archived}. Note that the `multiArchiveTag` value is not included
45+
# in the response for the methods to {https://tokbox.com/developer/rest/#listing_archives list archives} and
46+
# {https://tokbox.com/developer/rest/#retrieve_archive_info retrieve archive information}. If you do not specify a unique `multiArchiveTag`,
47+
# you can only record one archive at a time for a given session.
48+
# {https://tokbox.com/developer/guides/archiving/#simultaneous-archives See Simultaneous archives}.
4249
# @option options [String] :output_mode Whether all streams in the archive are recorded
4350
# to a single file (<code>:composed</code>, the default) or to individual files
4451
# (<code>:individual</code>). For more information on archiving and the archive file
4552
# formats, see the {https://tokbox.com/opentok/tutorials/archiving OpenTok archiving}
4653
# programming guide.
47-
# @option options [String] :resolution The resolution of the archive, either "640x480" (SD, the
48-
# default) or "1280x720" (HD). This property only applies to composed archives. If you set
49-
# this property and set the outputMode property to "individual", the call the method
50-
# results in an error.
54+
# @option options [String] :resolution The resolution of the archive, either "640x480" (SD landscape,
55+
# the default), "1280x720" (HD landscape), "1920x1080" (FHD landscape), "480x640" (SD portrait), "720x1280"
56+
# (HD portrait), or "1080x1920" (FHD portrait). This property only applies to composed archives. If you set
57+
# this property and set the outputMode property to "individual", a call to the method
58+
# results in an error.
5159
# @option options [String] :streamMode (Optional) Whether streams included in the archive are selected
5260
# automatically ("auto", the default) or manually ("manual"). When streams are selected automatically ("auto"),
5361
# all streams in the session can be included in the archive. When streams are selected manually ("manual"),
5462
# you specify streams to be included based on calls to the {Archives#add_stream} method. You can specify whether a
55-
# stream's audio, video, or both are included in the archive.
63+
# stream's audio, video, or both are included in the archive.
5664
# In composed archives, in both automatic and manual modes, the archive composer includes streams based
5765
# on {https://tokbox.com/developer/guides/archive-broadcast-layout/#stream-prioritization-rules stream prioritization rules}.
5866
# Important: this feature is currently available in the Standard environment only.

lib/opentok/broadcast.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ module OpenTok
2020
# For this start method, this timestamp matches the createdAt timestamp.
2121
#
2222
# @attr [string] resolution
23-
# The resolution of the broadcast: either "640x480" (SD, the default) or "1280x720" (HD). This property is optional.
23+
# The resolution of the broadcast: either "640x480" (SD landscape, the default), "1280x720" (HD landscape),
24+
# "1920x1080" (FHD landscape), "480x640" (SD portrait), "720x1280" (HD portrait), or "1080x1920" (FHD portrait).
25+
# You may want to use a portrait aspect ratio for broadcasts that include video streams from mobile devices (which often use the portrait aspect ratio).
26+
# This property is optional.
2427
#
2528
# @attr [string] streamMode
2629
# Whether streams included in the broadcast are selected automatically ("auto", the default) or manually ("manual").
@@ -43,12 +46,13 @@ module OpenTok
4346
# * "offline" -- The OpenTok platform could not connect to the remote RTMP server. This is due to an unreachable server or an error in the RTMP handshake. Causes include rejected RTMP connections, non-existing RTMP applications, rejected stream names, authentication errors, etc. Check that the server is online, and that you have provided the correct server URL and stream name.
4447
# * "error" -- There is an error in the OpenTok platform.
4548
class Broadcast
46-
49+
attr_reader :multi_broadcast_tag
4750
# @private
4851
def initialize(interface, json)
4952
@interface = interface
5053
# TODO: validate json fits schema
5154
@json = json
55+
@multi_broadcast_tag = @json['multiBroadcastTag']
5256
end
5357

5458
# A JSON-encoded string representation of the broadcast.

lib/opentok/broadcasts.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ def initialize(client)
3737
# If you do not specify an initial layout type, the broadcast uses the best fit
3838
# layout type.
3939
#
40+
# @option options [String] :multiBroadcastTag (Optional) Set this to support multiple broadcasts for the same session simultaneously.
41+
# Set this to a unique string for each simultaneous broadcast of an ongoing session. Note that the `multiBroadcastTag` value is *not* included
42+
# in the response for the methods to {https://tokbox.com/developer/rest/#list_broadcasts list live streaming broadcasts} and
43+
# {https://tokbox.com/developer/rest/#get_info_broadcast get information about a live streaming broadcast}.
44+
# {https://tokbox.com/developer/guides/broadcast/live-streaming#simultaneous-broadcasts See Simultaneous broadcasts}.
45+
#
4046
# @option options [int] maxDuration
4147
# The maximum duration for the broadcast, in seconds. The broadcast will automatically stop when
4248
# the maximum duration is reached. You can set the maximum duration to a value from 60 (60 seconds) to 36000 (10 hours).
@@ -75,7 +81,9 @@ def initialize(client)
7581
# Broadcasts#find method.
7682
#
7783
# @option options [string] resolution
78-
# The resolution of the broadcast: either "640x480" (SD, the default) or "1280x720" (HD).
84+
# The resolution of the broadcast: either "640x480" (SD landscape, the default), "1280x720" (HD landscape),
85+
# "1920x1080" (FHD landscape), "480x640" (SD portrait), "720x1280" (HD portrait), or "1080x1920"
86+
# (FHD portrait).
7987
#
8088
# @option options [String] :streamMode (Optional) Whether streams included in the broadcast are selected
8189
# automatically ("auto", the default) or manually ("manual"). When streams are selected automatically ("auto"),

0 commit comments

Comments
 (0)