opentok 4.7.1 → 4.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +8 -0
- data/lib/opentok/archive.rb +2 -1
- data/lib/opentok/archives.rb +13 -4
- data/lib/opentok/captions.rb +61 -0
- data/lib/opentok/client.rb +268 -203
- data/lib/opentok/exceptions.rb +2 -0
- data/lib/opentok/opentok.rb +11 -5
- data/lib/opentok/version.rb +1 -1
- data/spec/cassettes/OpenTok_Archives/should_create_an_archive_with_matching_multi_archive_tag_when_multiArchiveTag_is_specified.yml +1 -1
- data/spec/cassettes/OpenTok_Archives/should_create_an_archive_with_streamMode_set_to_specified_stream_mode_value.yml +52 -0
- data/spec/cassettes/OpenTok_Archives/should_create_an_archives_with_a_specified_multiArchiveTag.yml +1 -1
- data/spec/cassettes/OpenTok_Captions/receives_a_valid_response_when_starting_captions.yml +44 -0
- data/spec/cassettes/OpenTok_Captions/receives_a_valid_response_when_starting_captions_with_options.yml +44 -0
- data/spec/cassettes/OpenTok_Captions/receives_a_valid_response_when_stopping_captions.yml +44 -0
- data/spec/opentok/archives_spec.rb +9 -2
- data/spec/opentok/captions_spec.rb +44 -0
- metadata +14 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5299537135033f2ae95169f0a47017542fc51ac3bcf24e469219d3f00db5cda
|
4
|
+
data.tar.gz: 655c9293034b05b48f39f5f15809d0550f4774c5a097fb49bcf2aa46611e2c44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b83473744134b0754c092d2a98e6d28af5a80c6ee373c48c8569af75cf84fc0106321c6a7b8e72ec253379bc4a4e431069a3c62fdcf45f7fba172ebf61e700f
|
7
|
+
data.tar.gz: b6946da6f229d0030fde0a09a9e969c7906f7da54151ed1f749b6af9bcd0ea0e1787521a73a98c23cebbaa60df4b8e79bddd39acd2d8367b721909488f65bc26
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 4.8.1
|
2
|
+
|
3
|
+
* Fixes a bug with the `Archives#create` method. See [#269](https://github.com/opentok/OpenTok-Ruby-SDK/pull/269) and [#270](https://github.com/opentok/OpenTok-Ruby-SDK/pull/270)
|
4
|
+
|
5
|
+
# 4.8.0
|
6
|
+
|
7
|
+
* Add support for Captions API [#267](https://github.com/opentok/OpenTok-Ruby-SDK/pull/267)
|
8
|
+
|
1
9
|
# 4.7.1
|
2
10
|
|
3
11
|
* Updates docs comments for `Broadcasts` and `Sip` [#266](https://github.com/opentok/OpenTok-Ruby-SDK/pull/266)
|
data/lib/opentok/archive.rb
CHANGED
@@ -72,13 +72,14 @@ module OpenTok
|
|
72
72
|
# set to null. The download URL is obfuscated, and the file is only available from the URL for
|
73
73
|
# 10 minutes. To generate a new URL, call the Archive.listArchives() or OpenTok.getArchive() method.
|
74
74
|
class Archive
|
75
|
-
attr_reader :multi_archive_tag
|
75
|
+
attr_reader :multi_archive_tag, :stream_mode
|
76
76
|
# @private
|
77
77
|
def initialize(interface, json)
|
78
78
|
@interface = interface
|
79
79
|
# TODO: validate json fits schema
|
80
80
|
@json = json
|
81
81
|
@multi_archive_tag = @json['multiArchiveTag']
|
82
|
+
@stream_mode = @json['streamMode']
|
82
83
|
end
|
83
84
|
|
84
85
|
# A JSON-encoded string representation of the archive.
|
data/lib/opentok/archives.rb
CHANGED
@@ -39,11 +39,11 @@ module OpenTok
|
|
39
39
|
# (a video track is included). If you set both <code>has_audio</code> and
|
40
40
|
# <code>has_video</code> to <code>false</code>, the call to the <code>create()</code>
|
41
41
|
# method results in an error.
|
42
|
-
# @option options [String] :
|
42
|
+
# @option options [String] :multi_archive_tag (Optional) Set this to support recording multiple archives for the same session simultaneously.
|
43
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
44
|
# that is {https://tokbox.com/developer/guides/archiving/#automatic automatically archived}. Note that the `multiArchiveTag` value is not included
|
45
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 `
|
46
|
+
# {https://tokbox.com/developer/rest/#retrieve_archive_info retrieve archive information}. If you do not specify a unique `multi_archive_tag`,
|
47
47
|
# you can only record one archive at a time for a given session.
|
48
48
|
# {https://tokbox.com/developer/guides/archiving/#simultaneous-archives See Simultaneous archives}.
|
49
49
|
# @option options [String] :output_mode Whether all streams in the archive are recorded
|
@@ -56,7 +56,7 @@ module OpenTok
|
|
56
56
|
# (HD portrait), or "1080x1920" (FHD portrait). This property only applies to composed archives. If you set
|
57
57
|
# this property and set the outputMode property to "individual", a call to the method
|
58
58
|
# results in an error.
|
59
|
-
# @option options [String] :
|
59
|
+
# @option options [String] :stream_mode (Optional) Whether streams included in the archive are selected
|
60
60
|
# automatically ("auto", the default) or manually ("manual"). When streams are selected automatically ("auto"),
|
61
61
|
# all streams in the session can be included in the archive. When streams are selected manually ("manual"),
|
62
62
|
# you specify streams to be included based on calls to the {Archives#add_stream} method. You can specify whether a
|
@@ -97,7 +97,16 @@ module OpenTok
|
|
97
97
|
"Resolution cannot be supplied for individual output mode" if options.key?(:resolution) and options[:output_mode] == :individual
|
98
98
|
|
99
99
|
# normalize opts so all keys are symbols and only include valid_opts
|
100
|
-
valid_opts = [
|
100
|
+
valid_opts = [
|
101
|
+
:name,
|
102
|
+
:has_audio,
|
103
|
+
:has_video,
|
104
|
+
:output_mode,
|
105
|
+
:resolution,
|
106
|
+
:layout,
|
107
|
+
:multi_archive_tag,
|
108
|
+
:stream_mode
|
109
|
+
]
|
101
110
|
opts = options.inject({}) do |m,(k,v)|
|
102
111
|
if valid_opts.include? k.to_sym
|
103
112
|
m[k.to_sym] = v
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module OpenTok
|
2
|
+
# A class for working with OpenTok captions.
|
3
|
+
class Captions
|
4
|
+
# @private
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
# Starts live captions for the specified OpenTok session.
|
10
|
+
# See the {https://tokbox.com/developer/guides/live-captions/ OpenTok Live Captions developer guide}.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# opts = { "language_code" => "en-GB",
|
14
|
+
# "max_duration" => 5000,
|
15
|
+
# "partial_captions" => false,
|
16
|
+
# "status_callback_url" => status_callback_url
|
17
|
+
# }
|
18
|
+
# response = opentok.captions.start(session_id, token, opts)
|
19
|
+
#
|
20
|
+
# @param [String] session_id The session ID corresponding to the session for which captions will start.
|
21
|
+
# @param [String] token The token for the session ID with which the SIP user will use to connect.
|
22
|
+
# @param [Hash] options A hash defining options for the captions. For example:
|
23
|
+
# @option options [String] :language_code The BCP-47 code for a spoken language used on this call.
|
24
|
+
# The default value is "en-US". The following language codes are supported:
|
25
|
+
# - "en-AU" (English, Australia)
|
26
|
+
# - "en-GB" (Englsh, UK)
|
27
|
+
# - "es-US" (English, US)
|
28
|
+
# - "zh-CN” (Chinese, Simplified)
|
29
|
+
# - "fr-FR" (French)
|
30
|
+
# - "fr-CA" (French, Canadian)
|
31
|
+
# - "de-DE" (German)
|
32
|
+
# - "hi-IN" (Hindi, Indian)
|
33
|
+
# - "it-IT" (Italian)
|
34
|
+
# - "ja-JP" (Japanese)
|
35
|
+
# - "ko-KR" (Korean)
|
36
|
+
# - "pt-BR" (Portuguese, Brazilian)
|
37
|
+
# - "th-TH" (Thai)
|
38
|
+
# @option options [Integer] :max_duration The maximum duration for the audio captioning, in seconds.
|
39
|
+
# The default value is 14,400 seconds (4 hours), the maximum duration allowed.
|
40
|
+
# @option options [Boolean] :partial_captions Whether to enable this to faster captioning at the cost of some
|
41
|
+
# degree of inaccuracies. The default value is `true`.
|
42
|
+
# @option options [String] :status_callback_url A publicly reachable URL controlled by the customer and capable
|
43
|
+
# of generating the content to be rendered without user intervention. The minimum length of the URL is 15
|
44
|
+
# characters and the maximum length is 2048 characters.
|
45
|
+
# For more information, see {https://tokbox.com/developer/guides/live-captions/#live-caption-status-updates Live Caption status updates}.
|
46
|
+
def start(session_id, token, options = {})
|
47
|
+
@client.start_live_captions(session_id, token, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Starts live captions for the specified OpenTok session.
|
51
|
+
# See the {https://tokbox.com/developer/guides/live-captions/ OpenTok Live Captions developer guide}.
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# response = opentok.captions.stop(captions_id)
|
55
|
+
#
|
56
|
+
# @param [String] captions_id The ID for the captions to be stopped (returned from the `start` request).
|
57
|
+
def stop(captions_id)
|
58
|
+
@client.stop_live_captions(captions_id)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|