opentok 4.3.0 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/README.md +1 -1
- data/lib/opentok/archives.rb +2 -3
- data/lib/opentok/broadcasts.rb +41 -8
- data/lib/opentok/opentok.rb +5 -5
- data/lib/opentok/streams.rb +7 -9
- data/lib/opentok/version.rb +1 -1
- data/spec/opentok/broadcasts_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6c9c87f306480694d35b2f47c92bc20b65686061fb610c3d5d1d4f9cf863b81
|
4
|
+
data.tar.gz: 6e92e0db27f27fa7468235345dc69eb52a0e694fbddfe75e0ac75d9801537f09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dc075e65d9723382a4b0b421d72326dda3268d9eaf4b1c23aea4ccb35d7b66291182dd9c38cb96b9b66f2de9212715920d39a5fa5b6e1e7d12d187818edcc2b
|
7
|
+
data.tar.gz: 5d829c2f208d314ac37f923cef98993e69307a13418ea359e5685ece36f80320949fe500fe24f499cd86eab1cbfd293c9151cd8908c11492a2e01db3eecf2609
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -489,7 +489,7 @@ Reference documentation is available at <http://www.tokbox.com//opentok/librarie
|
|
489
489
|
# Requirements
|
490
490
|
|
491
491
|
You need an OpenTok API key and API secret, which you can obtain by logging into your
|
492
|
-
[
|
492
|
+
[Vonage Video API account](https://tokbox.com/account).
|
493
493
|
|
494
494
|
The OpenTok Ruby SDK requires Ruby 2.1.0 or greater.
|
495
495
|
|
data/lib/opentok/archives.rb
CHANGED
@@ -51,11 +51,10 @@ module OpenTok
|
|
51
51
|
# @option options [String] :streamMode (Optional) Whether streams included in the archive are selected
|
52
52
|
# automatically ("auto", the default) or manually ("manual"). When streams are selected automatically ("auto"),
|
53
53
|
# all streams in the session can be included in the archive. When streams are selected manually ("manual"),
|
54
|
-
# you specify streams to be included based on calls to
|
55
|
-
# { https://tokbox.com/developer/rest/#selecting-archive-streams }. You can specify whether a
|
54
|
+
# you specify streams to be included based on calls to the {Archives#add_stream} method. You can specify whether a
|
56
55
|
# stream's audio, video, or both are included in the archive.
|
57
56
|
# In composed archives, in both automatic and manual modes, the archive composer includes streams based
|
58
|
-
# on
|
57
|
+
# on {https://tokbox.com/developer/guides/archive-broadcast-layout/#stream-prioritization-rules stream prioritization rules}.
|
59
58
|
# Important: this feature is currently available in the Standard environment only.
|
60
59
|
# @option options [Hash] :layout Specify this to assign the initial layout type for
|
61
60
|
# the archive. This applies only to composed archives. This is a hash containing three keys:
|
data/lib/opentok/broadcasts.rb
CHANGED
@@ -42,15 +42,37 @@ module OpenTok
|
|
42
42
|
# the maximum duration is reached. You can set the maximum duration to a value from 60 (60 seconds) to 36000 (10 hours).
|
43
43
|
# The default maximum duration is 4 hours (14,400 seconds).
|
44
44
|
#
|
45
|
-
# @option options [Hash] outputs
|
45
|
+
# @option options [Hash] outputs (Required)
|
46
46
|
# This object defines the types of broadcast streams you want to start (both HLS and RTMP).
|
47
47
|
# You can include HLS, RTMP, or both as broadcast streams. If you include RTMP streaming,
|
48
48
|
# you can specify up to five target RTMP streams (or just one).
|
49
|
-
#
|
50
|
-
#
|
51
|
-
# For each RTMP , specify (<code>:serverUrl</code>) for the RTMP server URL,
|
49
|
+
#
|
50
|
+
# For multiple RTMP streams, the (<code>:rtmp</code>) property is set to an [Array] of Rtmp [Hash] objects.
|
51
|
+
# For each RTMP hash, specify (<code>:serverUrl</code>) for the RTMP server URL,
|
52
52
|
# (<code>:streamName</code>) such as the YouTube Live stream name or the Facebook stream key),
|
53
|
-
# and (optionally) (<code>:id</code>), a unique ID for the stream.
|
53
|
+
# and (optionally) (<code>:id</code>), a unique ID for the stream. If you specify an ID, it will be
|
54
|
+
# included in the (<code>broadcast_json</code>) response from the Client#start_broadcast method call,
|
55
|
+
# and is also available in the (<code>broadcast_json</code>) response from the Broadcasts#find method.
|
56
|
+
# Vonage streams the session to each RTMP URL you specify. Note that OpenTok live streaming
|
57
|
+
# supports RTMP and RTMPS.
|
58
|
+
# If you need to support only one RTMP URL, you can set a Rtmp [Hash] object (instead of an array of
|
59
|
+
# objects) for the (<code>:rtmp</code>) property value in the (<code>:outputs</code>) [Hash].
|
60
|
+
#
|
61
|
+
# For HLS, the (<code>:hls</code>) property in the (<code>:outputs</code>) [Hash] is set to a HLS [Hash]
|
62
|
+
# object. This object includes the following optional properties:
|
63
|
+
# - (<code>:dvr</code>) (Boolean). Whether to enable
|
64
|
+
# {https://tokbox.com/developer/guides/broadcast/live-streaming/#dvr DVR functionality}
|
65
|
+
# (rewinding, pausing, and resuming)
|
66
|
+
# in players that support it (true), or not (false, the default). With DVR enabled, the HLS URL will
|
67
|
+
# include a ?DVR query string appended to the end.
|
68
|
+
# - (<code>:low_latency</code>) (Boolean). Whether to enable
|
69
|
+
# {https://tokbox.com/developer/guides/broadcast/live-streaming/#low-latency low-latency mode}
|
70
|
+
# for the HLSstream.
|
71
|
+
# Some HLS players do not support low-latency mode. This feature is incompatible with DVR mode HLS
|
72
|
+
# broadcasts (both can't be set to true). This is a beta feature.
|
73
|
+
# The HLS URL is included in the (<code>broadcast_json</code>) response from the Client#start_broadcast
|
74
|
+
# method call, and is also available in the (<code>broadcast_json</code>) response from the
|
75
|
+
# Broadcasts#find method.
|
54
76
|
#
|
55
77
|
# @option options [string] resolution
|
56
78
|
# The resolution of the broadcast: either "640x480" (SD, the default) or "1280x720" (HD).
|
@@ -58,11 +80,11 @@ module OpenTok
|
|
58
80
|
# @option options [String] :streamMode (Optional) Whether streams included in the broadcast are selected
|
59
81
|
# automatically ("auto", the default) or manually ("manual"). When streams are selected automatically ("auto"),
|
60
82
|
# all streams in the session can be included in the broadcast. When streams are selected manually ("manual"),
|
61
|
-
# you specify streams to be included based on calls to
|
62
|
-
# {
|
83
|
+
# you specify streams to be included based on calls to the
|
84
|
+
# {Broadcasts#add_stream} method. You can specify whether a
|
63
85
|
# stream's audio, video, or both are included in the broadcast.
|
64
86
|
# For both automatic and manual modes, the broadcast composer includes streams based
|
65
|
-
# on
|
87
|
+
# on {https://tokbox.com/developer/guides/archive-broadcast-layout/#stream-prioritization-rules stream prioritization rules}.
|
66
88
|
# Important: this feature is currently available in the Standard environment only.
|
67
89
|
#
|
68
90
|
# @return [Broadcast] The broadcast object, which includes properties defining the broadcast,
|
@@ -75,6 +97,13 @@ module OpenTok
|
|
75
97
|
def create(session_id, options = {})
|
76
98
|
raise ArgumentError, "session_id not provided" if session_id.to_s.empty?
|
77
99
|
raise ArgumentError, "options cannot be empty" if options.empty?
|
100
|
+
raise ArgumentError, "outputs property is required in options" unless options.has_key?(:outputs)
|
101
|
+
raise ArgumentError, "outputs must be a Hash" unless options[:outputs].is_a? Hash
|
102
|
+
if options[:outputs].has_key?(:hls)
|
103
|
+
dvr = options[:outputs][:hls][:dvr]
|
104
|
+
low_latency = options[:outputs][:hls][:low_latency]
|
105
|
+
raise ArgumentError, "dvr and low_latency can't both be true for HLS" if hls_dvr_and_low_latency_options_both_true?(dvr, low_latency)
|
106
|
+
end
|
78
107
|
broadcast_json = @client.start_broadcast(session_id, options)
|
79
108
|
Broadcast.new self, broadcast_json
|
80
109
|
end
|
@@ -263,5 +292,9 @@ module OpenTok
|
|
263
292
|
has_audio == false && has_video == false
|
264
293
|
end
|
265
294
|
|
295
|
+
def hls_dvr_and_low_latency_options_both_true?(dvr, low_latency)
|
296
|
+
dvr == true && low_latency == true
|
297
|
+
end
|
298
|
+
|
266
299
|
end
|
267
300
|
end
|
data/lib/opentok/opentok.rb
CHANGED
@@ -42,9 +42,9 @@ module OpenTok
|
|
42
42
|
# streams, and signal. (This is the default value if you do not specify a role.)
|
43
43
|
#
|
44
44
|
# * <code>:moderator</code> -- In addition to the privileges granted to a
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
45
|
+
# publisher, a moderator can perform moderation functions, such as forcing clients
|
46
|
+
# to disconnect, to stop publishing streams, or to mute audio in published streams. See the
|
47
|
+
# {https://tokbox.com/developer/guides/moderation/ Moderation developer guide}.
|
48
48
|
# @option options [integer] :expire_time The expiration time, in seconds since the UNIX epoch.
|
49
49
|
# Pass in 0 to use the default expiration time of 24 hours after the token creation time.
|
50
50
|
# The maximum expiration time is 30 days after the creation time.
|
@@ -77,8 +77,8 @@ module OpenTok
|
|
77
77
|
# @param [String] api_key The OpenTok API key for your
|
78
78
|
# {https://tokbox.com/account OpenTok project}.
|
79
79
|
# @param [String] api_secret Your OpenTok API key.
|
80
|
-
# @option opts [Symbol] :api_url Do not set this parameter. It is for internal use by
|
81
|
-
# @option opts [Symbol] :ua_addendum Do not set this parameter. It is for internal use by
|
80
|
+
# @option opts [Symbol] :api_url Do not set this parameter. It is for internal use by Vonage.
|
81
|
+
# @option opts [Symbol] :ua_addendum Do not set this parameter. It is for internal use by Vonage.
|
82
82
|
# @option opts [Symbol] :timeout_length Custom timeout in seconds. If not provided, defaults to 2 seconds.
|
83
83
|
def initialize(api_key, api_secret, opts={})
|
84
84
|
@api_key = api_key.to_s()
|
data/lib/opentok/streams.rb
CHANGED
@@ -92,18 +92,16 @@ module OpenTok
|
|
92
92
|
# by calling the disable_force_mute() method.
|
93
93
|
#
|
94
94
|
# @param [String] session_id The session ID.
|
95
|
-
# @param [Hash] opts An optional hash defining options for muting action. For example:
|
95
|
+
# @param [Hash] opts An optional hash defining options for the muting action. For example:
|
96
|
+
# {
|
97
|
+
# "excluded_streams" => [
|
98
|
+
# "excludedStreamId1",
|
99
|
+
# "excludedStreamId2"
|
100
|
+
# ]
|
101
|
+
# }
|
96
102
|
# @option opts [Array] :excluded_streams The stream IDs for streams that should not be muted.
|
97
103
|
# This is an optional property. If you omit this property, all streams in the session will be muted.
|
98
104
|
#
|
99
|
-
# @example
|
100
|
-
# {
|
101
|
-
# "excluded_streams" => [
|
102
|
-
# "excludedStreamId1",
|
103
|
-
# "excludedStreamId2"
|
104
|
-
# ]
|
105
|
-
# }
|
106
|
-
#
|
107
105
|
def force_mute_all(session_id, opts = {})
|
108
106
|
opts['active'] = 'true'
|
109
107
|
response = @client.force_mute_session(session_id, opts)
|
data/lib/opentok/version.rb
CHANGED
@@ -45,6 +45,22 @@ describe OpenTok::Broadcasts do
|
|
45
45
|
broadcast.create(nil, {})
|
46
46
|
}.to raise_error(ArgumentError)
|
47
47
|
end
|
48
|
+
it 'raises an error if outputs is not set in options' do
|
49
|
+
opts = { maxDuration: 5400 }
|
50
|
+
expect { broadcast.create(nil, opts) }.to raise_error(ArgumentError)
|
51
|
+
end
|
52
|
+
it 'raises an error if outputs is set in options but is not a Hash' do
|
53
|
+
opts = { outputs: [] }
|
54
|
+
expect { broadcast.create(nil, opts) }.to raise_error(ArgumentError)
|
55
|
+
end
|
56
|
+
it 'raises an error if an HLS Broadcast object has both dvr and low_latency options set to true' do
|
57
|
+
opts = {
|
58
|
+
outputs: {
|
59
|
+
hls: { dvr: true, low_latency: true}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
expect { broadcast.create(nil, opts) }.to raise_error(ArgumentError)
|
63
|
+
end
|
48
64
|
it 'fetches a hls broadcast url', :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
|
49
65
|
opts = {
|
50
66
|
:outputs => {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentok
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stijn Mathysen
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2022-
|
15
|
+
date: 2022-05-09 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: bundler
|