|
| 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 | + ) |
0 commit comments