Skip to content

Commit 290fdef

Browse files
authored
Merge pull request #201 from opentok/dev
Version 3.2.0
2 parents 5c6dd79 + 50b3d4d commit 290fdef

15 files changed

+1075
-38
lines changed

.bumpversion.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[bumpversion]
2-
current_version = 3.1.0
2+
current_version = 3.2.0
33
commit = True
44
tag = False
55

6-
[bumpversion:file:opentok/version.py]
6+
[bumpversion:file:opentok/version.py]

.github/workflows/ot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: [3.5, 3.6, 3.7, 3.8.8, 3.9]
11+
python-version: [3.6, 3.7, 3.8.8, 3.9]
1212

1313
steps:
1414
- uses: actions/checkout@v2

CHANGES.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Release v3.2.0
2+
3+
## Added
4+
5+
- Mute all and mute stream functionality [#192](https://github.com/opentok/Opentok-Python-SDK/pull/192), [#197](https://github.com/opentok/Opentok-Python-SDK/pull/197), [#199](https://github.com/opentok/Opentok-Python-SDK/pull/199)
6+
- Added selective stream feature to `Archive` and `Broadcast` objects. [#196](https://github.com/opentok/Opentok-Python-SDK/pull/196)
7+
- Added PlayDTMF functionality to `SipCall` object [#194](https://github.com/opentok/Opentok-Python-SDK/pull/194)
8+
- Added SIP video outbound flag to `SipCall.dial` method [#194](https://github.com/opentok/Opentok-Python-SDK/pull/194)
9+
- Added the ObserveForceMute flag to `SipCall.dial` method [#193](https://github.com/opentok/Opentok-Python-SDK/pull/193)
10+
11+
# 3.2.0b1
12+
13+
## Added
14+
15+
- Added mute/muteall functionality
16+
17+
# Release v3.1.0
18+
19+
## Added
20+
21+
* #188 - Added support for archive layouts, as well as the new `screenshareType` option for screenshare layouts
22+
23+
# Release v3.0.1
24+
25+
# Changes
26+
27+
- Fixed `readme.rst` not displaying properly on Pypi
28+
29+
Thank you for your support and we are definitely excited to release even more exciting updates!! Stay tuned!!
30+
31+
# Release v3.0.0
32+
33+
# 🎉 Version 3.0 Changes
34+
35+
- Verb to Noun format to make the SDK code more human-readable and maintain consistency with industry standard
36+
- Renamed the Opentok class to Client to ensure compliance with best practice and industry standards
37+
- Improved JWT generation
38+
- Improved error handling
39+
- Fixed Enum34 related issues
40+
41+
# v2.11.0
42+
43+
Fixing issues with Enum34.
44+
45+
# Release v2.10.0
46+
47+
- Add Broadcast APIs
48+
Thanks @normanargueta!
49+
50+
# Release v2.9.0
51+
52+
- Added SIP Dial API
53+
- Added Set Stream Class Lists API
54+
55+
Thanks @normanargueta!
56+
57+
# Release v2.8.0
58+
59+
- List Archives filtration by sessionId (#137 )
60+
- Added Update Archive Layout functionality (#139)
61+
62+
# Release v2.7.0
63+
64+
Added `resolution` parameter for `start_archive`
65+
Added `signal` API
66+
Added `force_disconnect` API
67+
Added `get_stream` API
68+
Added `list_streams` API
69+
70+
Thanks @normanargueta and @maikthomas
71+
72+
# Release v2.6.0
73+
74+
- Add timeout option to opentok constructor (#117, #57 Thanks @tylergould!)
75+
76+
# Release v2.5.1
77+
78+
Changes:
79+
80+
- Exceptions now inherit from `Exception` instead of `BaseException` (#115, thanks @fernandogrd)
81+
82+
As well as:
83+
84+
- Update archive documentation (#80)
85+
- Document the `initial_layout_class_list` param for the `generate_token` function (#112)
86+
- Refactor sample app (#111)
87+
88+
# Release v2.5.0
89+
90+
This updates includes the following changes:
91+
92+
- [Adds support for the `initial_layout_class_list` field in tokens](https://github.com/opentok/Opentok-Python-SDK/pull/77)
93+
- [Adds support for JWT `X-OPENTOK-AUTH` header, replacing the deprecated `X-TB-PARTNER-AUTH` header](https://github.com/opentok/Opentok-Python-SDK/pull/86)
94+
- [Updates the REST API endpoint URL to use `/project/` replacing the deprecated `/partner/`](https://github.com/opentok/Opentok-Python-SDK/pull/105)
95+
- [Only include connection data in generated token if it's been defined](https://github.com/opentok/Opentok-Python-SDK/pull/106)
96+
- [Ensure backwards compatibility with Python 2.6](https://github.com/opentok/Opentok-Python-SDK/pull/91)
97+
- [Removes Python 3.2 from supported version because it's not supported by our dependency](https://github.com/opentok/Opentok-Python-SDK/pull/105)
98+
99+
As well as:
100+
101+
- [Updates JS code in samples to use latest API and best practices](https://github.com/opentok/Opentok-Python-SDK/pull/108)
102+
- [Fix broken image paths in sample](https://github.com/opentok/Opentok-Python-SDK/pull/104)
103+
104+
# Release v2.5.0b1
105+
106+
This update adds support for the `initial_layout_class_list` field in tokens.
107+
108+
# Release v2.4.1
109+
110+
This update adds version information to the User-Agent string for analytics (#78)
111+
112+
# Release v2.4.0
113+
114+
This update adds proxy configuration as a feature of the OpenTok object. (thanks @juandebravo!)
115+
116+
Here is an example of using proxy configuration:
117+
118+
``` python
119+
from opentok import OpenTok
120+
121+
opentok = OpenTok(api_key, api_secret)
122+
opentok.proxies = {
123+
"http": "http://10.10.1.10:3128",
124+
"https": "http://10.10.1.10:1080",
125+
}
126+
session = opentok.create_session()
127+
```
128+
129+
The format for the proxy configuration is identical to the format used by the underlying [requests](http://docs.python-requests.org/en/latest/user/advanced/#proxies) library.
130+
131+
# Release v2.3.0
132+
133+
New archiving features:
134+
- Automatically archived sessions -- See the `archive_mode` parameter of the `opentok.create_session()` method and the `ArchiveModes` class.
135+
- Audio-only or video-only archives -- See the `has_audio` and `has_video` parameters of the `opentok.start_archive()` method.
136+
- Individual archiving -- See the `output_mode` parameter of the `opentok.start_archive()` method and the `OutputModes` class.
137+
- Paused archives -- When no clients are publishing to a session being archived, its status changes to "paused". See `archive.status`.
138+
139+
Other improvements:
140+
- Adds Python 3.4 support
141+
142+
# Release v2.2.1
143+
144+
The default setting for the `create_session()` method is to create a session with the media mode set
145+
to relayed. In previous versions of the SDK, the default setting was to use the OpenTok Media Router
146+
(media mode set to routed). In a relayed session, clients will attempt to send streams directly
147+
between each other (peer-to-peer); if clients cannot connect due to firewall restrictions, the
148+
session uses the OpenTok TURN server to relay audio-video streams.
149+
150+
# Release v2.2.0
151+
152+
This version of the SDK includes support for working with OpenTok 2.0 archives. (This API does not
153+
work with OpenTok 1.0 archives.)
154+
155+
The `OpenTok.create_session()` method now includes a `media_mode` parameter, instead of a `p2p` parameter.
156+
157+
For details, see the reference documentation at
158+
http://www.tokbox.com/opentok/libraries/server/python/reference/index.html.

opentok/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .opentok import OpenTok, Client, Roles, MediaModes, ArchiveModes
22
from .session import Session
3-
from .archives import Archive, ArchiveList, OutputModes
3+
from .archives import Archive, ArchiveList, OutputModes, StreamModes
44
from .exceptions import (
55
OpenTokException,
66
AuthError,
@@ -13,4 +13,4 @@
1313
from .stream import Stream
1414
from .streamlist import StreamList
1515
from .sip_call import SipCall
16-
from .broadcast import Broadcast
16+
from .broadcast import Broadcast, BroadcastStreamModes

opentok/archives.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ class OutputModes(Enum):
2626
individual = u("individual")
2727
"""Each stream in the archive is recorded to an individual file."""
2828

29+
class StreamModes(Enum):
30+
""""List of valid settings for the stream_mode parameter of the OpenTok.start_archive()
31+
method."""
32+
33+
auto = u("auto")
34+
"""Streams are automatically added to the archive."""
35+
manual = u("manual")
36+
"""Streams are included in the archive based on calls to the OpenTok.add_archive_stream()
37+
and OpenTok.remove_archive_stream() methods."""
2938

3039
class Archive(object):
3140
"""Represents an archive of an OpenTok session.
@@ -34,7 +43,7 @@ class Archive(object):
3443
The time at which the archive was created, in milliseconds since the UNIX epoch.
3544
3645
:ivar duration:
37-
The duration of the archive, in milliseconds.
46+
The duration of the archive, in seconds.
3847
3948
:ivar has_audio:
4049
Boolean value set to true when the archive contains an audio track,
@@ -55,6 +64,14 @@ class Archive(object):
5564
Whether all streams in the archive are recorded to a single file
5665
(OutputModes.composed) or to individual files (OutputModes.individual).
5766
67+
:ivar streamMode:
68+
Whether streams included in the archive are selected automatically
69+
("auto", the default) or manually ("manual").
70+
71+
:ivar streams:
72+
A list of streams currently being archived. This is only set for an archive with
73+
the status set to "started" and the stream_Mode set to "manual".
74+
5875
:ivar partner_id:
5976
The API key associated with the archive.
6077
@@ -113,6 +130,8 @@ def __init__(self, sdk, values):
113130
self.has_audio = values.get("hasAudio")
114131
self.has_video = values.get("hasVideo")
115132
self.output_mode = OutputModes[values.get("outputMode", "composed")]
133+
self.stream_mode = values.get("streamMode", StreamModes.auto)
134+
self.streams = values.get("streams")
116135
self.url = values.get("url")
117136
self.resolution = values.get("resolution")
118137

opentok/broadcast.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
import json
2+
from enum import Enum
3+
from six import iteritems, u
24

35

46
class Broadcast(object):
57
"""
6-
Represents a live streaming broadcast
8+
Represents a live streaming broadcast.
9+
10+
:ivar streamMode:
11+
Whether streams included in the broadcast are selected automatically
12+
("auto", the default) or manually ("manual").
13+
14+
:ivar streams:
15+
A list of streams currently being broadcast. This is only set for a broadcast with
16+
the status set to "started" and the stream_Mode set to "manual".
717
"""
818

919
def __init__(self, kwargs):
@@ -15,9 +25,21 @@ def __init__(self, kwargs):
1525
self.resolution = kwargs.get("resolution")
1626
self.status = kwargs.get("status")
1727
self.broadcastUrls = kwargs.get("broadcastUrls")
28+
self.stream_mode = kwargs.get("streamMode", BroadcastStreamModes.auto)
29+
self.streams = kwargs.get("streams")
1830

1931
def json(self):
2032
"""
2133
Returns a JSON representation of the broadcast
2234
"""
2335
return json.dumps(self, default=lambda o: o.__dict__, sort_keys=True, indent=4)
36+
37+
class BroadcastStreamModes(Enum):
38+
""""List of valid settings for the stream_mode parameter of the OpenTok.start_broadcast()
39+
method."""
40+
41+
auto = u("auto")
42+
"""Streams are automatically added to the broadcast."""
43+
manual = u("manual")
44+
"""Streams are included in the broadcast based on calls to the OpenTok.add_broadcast_stream()
45+
and OpenTok.remove_broadcast_stream() methods."""

opentok/endpoints.py

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def get_broadcast_url(self, broadcast_id=None, stop=False, layout=False):
130130
url = url + "/stop"
131131
if layout:
132132
url = url + "/layout"
133+
133134
return url
134135

135136
def get_mute_all_url(self, session_id):
@@ -142,4 +143,60 @@ def get_mute_all_url(self, session_id):
142143
+ session_id
143144
+ "/mute"
144145

145-
)
146+
)
147+
148+
return url
149+
150+
def get_dtmf_all_url(self, session_id):
151+
""" this method returns the url for Play DTMF to all clients in the session """
152+
url = (
153+
self.api_url
154+
+ "/v2/project/"
155+
+ self.api_key
156+
+ "/session/"
157+
+ session_id
158+
+ "/play-dtmf"
159+
)
160+
161+
return url
162+
163+
def get_dtmf_specific_url(self, session_id, connection_id):
164+
""" this method returns the url for Play DTMF to a specific client connection"""
165+
url = (
166+
self.api_url
167+
+ "/v2/project/"
168+
+ self.api_key
169+
+ "/session/"
170+
+ session_id
171+
+ "/connection/"
172+
+ connection_id
173+
+ "/play-dtmf"
174+
)
175+
176+
return url
177+
178+
def get_archive_stream(self, archive_id=None):
179+
""" this method returns urls for working with streamModes in archives """
180+
url = (
181+
self.api_url
182+
+ "/v2/project/"
183+
+ self.api_key
184+
+ "archive/"
185+
+ archive_id
186+
+ "/streams"
187+
)
188+
189+
return url
190+
191+
def get_broadcast_stream(self, broadcast_id=None):
192+
""" this method returns urls for working with streamModes in broadcasts """
193+
url = (
194+
self.api_url
195+
+ "/v2/partner/"
196+
+ self.api_key
197+
+ "broadcast/"
198+
+ broadcast_id
199+
+ "/streams"
200+
)
201+
202+
return url

opentok/exceptions.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,23 @@ class BroadcastError(OpenTokException):
8888
"""
8989

9090
pass
91+
92+
class DTMFError(OpenTokException):
93+
"""
94+
Indicates that one of the properties digits, session_id or connection_id is invalid
95+
"""
96+
97+
class ArchiveStreamModeError(OpenTokException):
98+
"""
99+
Indicates that the archive is configured with a streamMode that does not support stream manipulation.
100+
"""
101+
102+
pass
103+
104+
105+
class BroadcastStreamModeError(OpenTokException):
106+
"""
107+
Indicates that the broadcast is configured with a streamMode that does not support stream manipulation.
108+
"""
109+
110+
pass

0 commit comments

Comments
 (0)