Skip to content

Commit 8ca4c64

Browse files
Merge pull request #11 from DolbyIO/rts
New Real-time Streaming API
2 parents 9b88fbb + e002f25 commit 8ca4c64

File tree

5 files changed

+31
-27
lines changed

5 files changed

+31
-27
lines changed

.github/workflows/publish-package-to-pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout 🛎️
14-
uses: actions/checkout@v2.3.4
14+
uses: actions/checkout@v3
1515
with:
1616
persist-credentials: false
1717

@@ -35,7 +35,7 @@ jobs:
3535
3636
- name: Deploy to PyPI 🚀
3737
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
38-
uses: pypa/gh-action-pypi-publish@v1.4.2
38+
uses: pypa/gh-action-pypi-publish@release/v1
3939
with:
4040
user: __token__
4141
password: ${{ secrets.PYPI_API_TOKEN }}

cli/src/dolbyio_rest_apis_cli/communications/commands/streaming.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def add_arguments(sub_parsers: _SubParsersAction) -> None:
4343
)
4444

4545
parser.add_argument(
46-
'-u', '--urls',
47-
help='List of RTMP endpoint URLs.',
46+
'-u', '--url',
47+
help='The destination URI provided by the RTMP service.',
4848
nargs='*',
4949
required='start' in sys.argv and 'rtmp' in sys.argv,
5050
type=str
@@ -55,18 +55,17 @@ async def execute_command(args: Namespace) -> None:
5555
cid = args.cid
5656
action = args.action
5757
target = args.target
58-
urls = args.urls
58+
url = args.url
5959

6060
if target == 'rtmp':
6161
if action == 'start':
6262
print(f'Start the streaming to RTMP for the conference "{cid}".')
63-
for url in urls:
64-
print(f' - {url}')
63+
print(f' - {url}')
6564

6665
await streaming.start_rtmp(
6766
access_token=access_token,
6867
conference_id=cid,
69-
rtmp_urls=urls
68+
rtmp_url=url
7069
)
7170
elif action == 'stop':
7271
print(f'Stop the streaming to RTMP for the conference "{cid}".')

client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Python wrapper for the dolby.io REST [Communications](https://docs.dolby.io/comm
77
Check the [dolbyio-rest-apis](https://pypi.org/project/dolbyio-rest-apis/) package on PyPI. To install the latest stable python package run the following command:
88

99
```bash
10-
python3 -m pip install dolbyio-rest-apis
10+
python3 -m pip install dolbyio-rest-apis
1111
```
1212

1313
Upgrade your package to the latest version:

client/src/dolbyio_rest_apis/communications/conference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async def create_conference(
4141
rtcp_mode: (Optional) Specifies the bitrate adaptation mode for the video transmission.
4242
ttl: (Optional) Specifies the time to live that enables customizing the waiting time
4343
(in seconds) and terminating empty conferences.
44-
video_codec: (Optional) Specifies video codecs (VP8 or H264) for a specific conference.
44+
video_codec: (Optional) Specifies the video codec (VP8 or H264) for the conference.
4545
participants: List of the :class:`Participant` object to update the permissions.
4646
recording_formats: If specified, the default RecordingConfiguration is overridden.
4747
Specifies the recording format. Valid values are 'mp3' and 'mp4'.

client/src/dolbyio_rest_apis/communications/streaming.py

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,31 @@
77

88
from dolbyio_rest_apis.communications.internal.http_context import CommunicationsHttpContext
99
from dolbyio_rest_apis.communications.internal.urls import get_comms_url_v2
10-
from typing import List
10+
from dolbyio_rest_apis.core.helpers import add_if_not_none
1111

1212
async def start_rtmp(
1313
access_token: str,
1414
conference_id: str,
15-
rtmp_urls: List[str],
15+
rtmp_url: str,
1616
) -> None:
1717
r"""
1818
Starts the RTMP live stream for the specified conference. Once the Dolby.io Communications APIs service starts
1919
streaming to the target url, a `Stream.Rtmp.InProgress` Webhook event will be sent.
20-
You must use this API if the conference is protected using enhanced conference access control.
2120
2221
See: https://docs.dolby.io/communications-apis/reference/start-rtmp
2322
2423
Args:
2524
access_token: Access token to use for authentication.
2625
conference_id: Identifier of the conference.
27-
rtmp_urls: List of the RTMP endpoints where to send the RTMP stream to.
26+
rtmp_url: The destination URI provided by the RTMP service.
2827
2928
Raises:
3029
HttpRequestError: If a client error one occurred.
3130
HTTPError: If one occurred.
3231
"""
3332

3433
payload = {
35-
'uri': '|'.join(rtmp_urls),
34+
'uri': rtmp_url,
3635
}
3736

3837
async with CommunicationsHttpContext() as http_context:
@@ -47,8 +46,7 @@ async def stop_rtmp(
4746
conference_id: str,
4847
) -> None:
4948
r"""
50-
Stops an RTMP stream.
51-
You must use this API if the conference is protected using enhanced conference access control.
49+
Stops the RTMP stream of the specified conference.
5250
5351
See: https://docs.dolby.io/communications-apis/reference/stop-rtmp
5452
@@ -67,22 +65,28 @@ async def stop_rtmp(
6765
url=f'{get_comms_url_v2()}/conferences/mix/{conference_id}/rtmp/stop'
6866
)
6967

70-
async def start_lls(
68+
async def start_rts(
7169
access_token: str,
7270
conference_id: str,
7371
stream_name: str,
7472
publishing_token: str,
73+
layout_url: str=None,
7574
) -> None:
7675
r"""
77-
Starts a Low Latency Stream to Millicast.
76+
Starts real-time streaming using Dolby.io Real-time Streaming services (formerly Millicast).
7877
79-
See: https://docs.dolby.io/communications-apis/reference/start-rtmp
78+
See: https://docs.dolby.io/communications-apis/reference/start-rts
8079
8180
Args:
8281
access_token: Access token to use for authentication.
8382
conference_id: Identifier of the conference.
84-
stream_name: The Millicast stream name to which the conference will broadcasted.
85-
publishing_token:The Millicast publishing token used to identify the broadcaster.
83+
stream_name: The Dolby.io Real-time Streaming stream name to which the conference is broadcasted.
84+
publishing_token: The publishing token used to identify the broadcaster.
85+
layout_url: Overwrites the layout URL configuration:
86+
null: uses the layout URL configured in the dashboard
87+
(if no URL is set in the dashboard, then uses the Dolby.io default)
88+
default: uses the Dolby.io default layout
89+
URL string: uses this layout URL
8690
8791
Raises:
8892
HttpRequestError: If a client error one occurred.
@@ -93,22 +97,23 @@ async def start_lls(
9397
'stream_name': stream_name,
9498
'publishingToken': publishing_token,
9599
}
100+
add_if_not_none(payload, 'layoutUrl', layout_url)
96101

97102
async with CommunicationsHttpContext() as http_context:
98103
await http_context.requests_post(
99104
access_token=access_token,
100-
url=f'{get_comms_url_v2()}/conferences/mix/{conference_id}/lls/start',
105+
url=f'{get_comms_url_v2()}/conferences/mix/{conference_id}/rts/start',
101106
payload=payload,
102107
)
103108

104-
async def stop_lls(
109+
async def stop_rts(
105110
access_token: str,
106111
conference_id: str,
107112
) -> None:
108113
r"""
109-
Stops an existing Low Latency Stream to Millicast.
114+
Stops real-time streaming to Dolby.io Real-time Streaming services.
110115
111-
See: https://docs.dolby.io/communications-apis/reference/stop-lls
116+
See: https://docs.dolby.io/communications-apis/reference/stop-rts
112117
113118
Args:
114119
access_token: Access token to use for authentication.
@@ -122,5 +127,5 @@ async def stop_lls(
122127
async with CommunicationsHttpContext() as http_context:
123128
await http_context.requests_post(
124129
access_token=access_token,
125-
url=f'{get_comms_url_v2()}/conferences/mix/{conference_id}/lls/stop'
130+
url=f'{get_comms_url_v2()}/conferences/mix/{conference_id}/rts/stop'
126131
)

0 commit comments

Comments
 (0)