Skip to content

Commit 0fe7e74

Browse files
Merge pull request #12 from DolbyIO/recording
Add Recording API
2 parents 8ca4c64 + a051f01 commit 0fe7e74

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
"""
2+
dolbyio_rest_apis.communications.recording
3+
~~~~~~~~~~~~~~~
4+
5+
This module contains the functions to work with the recording API.
6+
"""
7+
8+
from dolbyio_rest_apis.communications.internal.http_context import CommunicationsHttpContext
9+
from dolbyio_rest_apis.communications.internal.urls import get_comms_url_v2
10+
from dolbyio_rest_apis.core.helpers import add_if_not_none
11+
12+
async def start(
13+
access_token: str,
14+
conference_id: str,
15+
layout_url: str=None,
16+
) -> None:
17+
r"""
18+
Starts recording for the specified conference.
19+
You can specify a custom layout URL per recording request.
20+
The `layoutURL` parameter overrides the layout URL configured in the dashboard.
21+
22+
See: https://docs.dolby.io/communications-apis/reference/api-recording-start
23+
24+
Args:
25+
access_token: Access token to use for authentication.
26+
conference_id: Identifier of the conference.
27+
layout_url: Overwrites the layout URL configuration.
28+
This field is ignored if it is not relevant regarding recording configuration,
29+
for example if live_recording set to false or if the recording is MP3 only.
30+
- `null`: uses the layout URL configured in the dashboard (if no URL is set in the dashboard, then uses the Dolby.io default);
31+
- `default`: uses the Dolby.io default layout;
32+
- URL string: uses this layout URL
33+
34+
Raises:
35+
HttpRequestError: If a client error one occurred.
36+
HTTPError: If one occurred.
37+
"""
38+
url = f'{get_comms_url_v2()}/conferences/mix/{conference_id}/recording/start'
39+
40+
payload = {}
41+
add_if_not_none(payload, 'layoutUrl', layout_url)
42+
43+
async with CommunicationsHttpContext() as http_context:
44+
await http_context.requests_post(
45+
access_token=access_token,
46+
url=url,
47+
payload=payload,
48+
)
49+
50+
async def stop(
51+
access_token: str,
52+
conference_id: str,
53+
) -> None:
54+
r"""
55+
Stops the recording of the specified conference.
56+
57+
See: https://docs.dolby.io/communications-apis/reference/api-recording-stop
58+
59+
Args:
60+
access_token: Access token to use for authentication.
61+
conference_id: Identifier of the conference.
62+
63+
Raises:
64+
HttpRequestError: If a client error one occurred.
65+
HTTPError: If one occurred.
66+
"""
67+
url = f'{get_comms_url_v2()}/conferences/mix/{conference_id}/recording/stop'
68+
69+
async with CommunicationsHttpContext() as http_context:
70+
await http_context.requests_post(
71+
access_token=access_token,
72+
url=url,
73+
)

client/src/dolbyio_rest_apis/communications/streaming.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ async def start_rtmp(
1313
access_token: str,
1414
conference_id: str,
1515
rtmp_url: str,
16+
layout_url: str=None,
1617
) -> None:
1718
r"""
1819
Starts the RTMP live stream for the specified conference. Once the Dolby.io Communications APIs service starts
@@ -24,6 +25,12 @@ async def start_rtmp(
2425
access_token: Access token to use for authentication.
2526
conference_id: Identifier of the conference.
2627
rtmp_url: The destination URI provided by the RTMP service.
28+
layout_url: Overwrites the layout URL configuration.
29+
This field is ignored if it is not relevant regarding recording configuration,
30+
for example if live_recording set to false or if the recording is MP3 only.
31+
- `null`: uses the layout URL configured in the dashboard (if no URL is set in the dashboard, then uses the Dolby.io default);
32+
- `default`: uses the Dolby.io default layout;
33+
- URL string: uses this layout URL
2734
2835
Raises:
2936
HttpRequestError: If a client error one occurred.
@@ -33,6 +40,7 @@ async def start_rtmp(
3340
payload = {
3441
'uri': rtmp_url,
3542
}
43+
add_if_not_none(payload, 'layoutUrl', layout_url)
3644

3745
async with CommunicationsHttpContext() as http_context:
3846
await http_context.requests_post(

0 commit comments

Comments
 (0)