gcore 0.6.0__py3-none-any.whl → 0.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gcore might be problematic. Click here for more details.

Files changed (185) hide show
  1. gcore/_client.py +9 -0
  2. gcore/_models.py +24 -3
  3. gcore/_version.py +1 -1
  4. gcore/pagination.py +101 -63
  5. gcore/resources/__init__.py +14 -0
  6. gcore/resources/cloud/__init__.py +28 -0
  7. gcore/resources/cloud/cloud.py +64 -0
  8. gcore/resources/cloud/cost_reports.py +811 -0
  9. gcore/resources/cloud/file_shares/file_shares.py +10 -0
  10. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +61 -26
  11. gcore/resources/cloud/inference/registry_credentials.py +4 -6
  12. gcore/resources/cloud/usage_reports.py +337 -0
  13. gcore/resources/iam/users.py +5 -5
  14. gcore/resources/streaming/__init__.py +159 -0
  15. gcore/resources/streaming/ai_tasks.py +1288 -0
  16. gcore/resources/streaming/broadcasts.py +579 -0
  17. gcore/resources/streaming/directories.py +515 -0
  18. gcore/resources/streaming/players.py +577 -0
  19. gcore/resources/streaming/playlists.py +1059 -0
  20. gcore/resources/streaming/quality_sets.py +331 -0
  21. gcore/resources/streaming/restreams.py +484 -0
  22. gcore/resources/streaming/statistics.py +3224 -0
  23. gcore/resources/streaming/streaming.py +390 -0
  24. gcore/resources/streaming/streams/__init__.py +33 -0
  25. gcore/resources/streaming/streams/overlays.py +716 -0
  26. gcore/resources/streaming/streams/streams.py +1592 -0
  27. gcore/resources/streaming/videos/__init__.py +33 -0
  28. gcore/resources/streaming/videos/subtitles.py +623 -0
  29. gcore/resources/streaming/videos/videos.py +1553 -0
  30. gcore/resources/waap/ip_info.py +28 -10
  31. gcore/types/cloud/__init__.py +10 -0
  32. gcore/types/cloud/cost_report_aggregated.py +865 -0
  33. gcore/types/cloud/cost_report_aggregated_monthly.py +865 -0
  34. gcore/types/cloud/cost_report_detailed.py +1343 -0
  35. gcore/types/cloud/cost_report_get_aggregated_monthly_params.py +394 -0
  36. gcore/types/cloud/cost_report_get_aggregated_params.py +409 -0
  37. gcore/types/cloud/cost_report_get_detailed_params.py +435 -0
  38. gcore/types/cloud/file_share.py +37 -3
  39. gcore/types/cloud/file_share_create_params.py +16 -0
  40. gcore/types/cloud/floating_ip.py +0 -9
  41. gcore/types/cloud/floating_ip_detailed.py +0 -9
  42. gcore/types/cloud/gpu_baremetal_cluster.py +2 -2
  43. gcore/types/cloud/gpu_baremetal_cluster_create_params.py +9 -0
  44. gcore/types/cloud/quota_get_all_response.py +24 -2
  45. gcore/types/cloud/quota_get_by_region_response.py +24 -2
  46. gcore/types/cloud/quotas/request_create_params.py +12 -1
  47. gcore/types/cloud/quotas/request_get_response.py +12 -1
  48. gcore/types/cloud/quotas/request_list_response.py +12 -1
  49. gcore/types/cloud/subnet.py +1 -1
  50. gcore/types/cloud/usage_report.py +1612 -0
  51. gcore/types/cloud/usage_report_get_params.py +432 -0
  52. gcore/types/streaming/__init__.py +143 -0
  53. gcore/types/streaming/ai_contentmoderation_casm.py +39 -0
  54. gcore/types/streaming/ai_contentmoderation_hardnudity.py +54 -0
  55. gcore/types/streaming/ai_contentmoderation_nsfw.py +39 -0
  56. gcore/types/streaming/ai_contentmoderation_softnudity.py +66 -0
  57. gcore/types/streaming/ai_contentmoderation_sport.py +39 -0
  58. gcore/types/streaming/ai_contentmoderation_weapon.py +39 -0
  59. gcore/types/streaming/ai_task.py +205 -0
  60. gcore/types/streaming/ai_task_cancel_response.py +12 -0
  61. gcore/types/streaming/ai_task_create_params.py +168 -0
  62. gcore/types/streaming/ai_task_create_response.py +10 -0
  63. gcore/types/streaming/ai_task_get_ai_settings_params.py +27 -0
  64. gcore/types/streaming/ai_task_get_ai_settings_response.py +12 -0
  65. gcore/types/streaming/ai_task_get_response.py +313 -0
  66. gcore/types/streaming/ai_task_list_params.py +50 -0
  67. gcore/types/streaming/broadcast.py +71 -0
  68. gcore/types/streaming/broadcast_create_params.py +76 -0
  69. gcore/types/streaming/broadcast_list_params.py +12 -0
  70. gcore/types/streaming/broadcast_spectators_count.py +12 -0
  71. gcore/types/streaming/broadcast_update_params.py +76 -0
  72. gcore/types/streaming/clip.py +78 -0
  73. gcore/types/streaming/create_video_param.py +214 -0
  74. gcore/types/streaming/direct_upload_parameters.py +33 -0
  75. gcore/types/streaming/directories_tree.py +19 -0
  76. gcore/types/streaming/directory_base.py +31 -0
  77. gcore/types/streaming/directory_create_params.py +15 -0
  78. gcore/types/streaming/directory_get_response.py +19 -0
  79. gcore/types/streaming/directory_item.py +13 -0
  80. gcore/types/streaming/directory_update_params.py +18 -0
  81. gcore/types/streaming/directory_video.py +13 -0
  82. gcore/types/streaming/ffprobes.py +25 -0
  83. gcore/types/streaming/max_stream_series.py +21 -0
  84. gcore/types/streaming/meet_series.py +23 -0
  85. gcore/types/streaming/player.py +114 -0
  86. gcore/types/streaming/player_create_params.py +18 -0
  87. gcore/types/streaming/player_list_params.py +12 -0
  88. gcore/types/streaming/player_param.py +114 -0
  89. gcore/types/streaming/player_update_params.py +18 -0
  90. gcore/types/streaming/playlist.py +102 -0
  91. gcore/types/streaming/playlist_create.py +12 -0
  92. gcore/types/streaming/playlist_create_params.py +102 -0
  93. gcore/types/streaming/playlist_list_params.py +12 -0
  94. gcore/types/streaming/playlist_list_videos_response.py +10 -0
  95. gcore/types/streaming/playlist_update_params.py +102 -0
  96. gcore/types/streaming/playlist_video.py +215 -0
  97. gcore/types/streaming/popular_videos.py +17 -0
  98. gcore/types/streaming/quality_set_set_default_params.py +23 -0
  99. gcore/types/streaming/quality_sets.py +57 -0
  100. gcore/types/streaming/restream.py +37 -0
  101. gcore/types/streaming/restream_create_params.py +41 -0
  102. gcore/types/streaming/restream_list_params.py +12 -0
  103. gcore/types/streaming/restream_update_params.py +41 -0
  104. gcore/types/streaming/statistic_get_ffprobes_params.py +22 -0
  105. gcore/types/streaming/statistic_get_live_unique_viewers_params.py +26 -0
  106. gcore/types/streaming/statistic_get_live_unique_viewers_response.py +25 -0
  107. gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py +32 -0
  108. gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py +30 -0
  109. gcore/types/streaming/statistic_get_max_streams_series_params.py +20 -0
  110. gcore/types/streaming/statistic_get_meet_series_params.py +20 -0
  111. gcore/types/streaming/statistic_get_popular_videos_params.py +15 -0
  112. gcore/types/streaming/statistic_get_storage_series_params.py +20 -0
  113. gcore/types/streaming/statistic_get_stream_series_params.py +20 -0
  114. gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py +27 -0
  115. gcore/types/streaming/statistic_get_unique_viewers_params.py +34 -0
  116. gcore/types/streaming/statistic_get_views_by_browsers_params.py +15 -0
  117. gcore/types/streaming/statistic_get_views_by_country_params.py +15 -0
  118. gcore/types/streaming/statistic_get_views_by_hostname_params.py +15 -0
  119. gcore/types/streaming/statistic_get_views_by_operating_system_params.py +15 -0
  120. gcore/types/streaming/statistic_get_views_by_referer_params.py +15 -0
  121. gcore/types/streaming/statistic_get_views_by_region_params.py +15 -0
  122. gcore/types/streaming/statistic_get_views_heatmap_params.py +21 -0
  123. gcore/types/streaming/statistic_get_views_params.py +34 -0
  124. gcore/types/streaming/statistic_get_vod_storage_volume_params.py +17 -0
  125. gcore/types/streaming/statistic_get_vod_transcoding_duration_params.py +17 -0
  126. gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py +26 -0
  127. gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py +32 -0
  128. gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py +30 -0
  129. gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py +22 -0
  130. gcore/types/streaming/storage_series.py +23 -0
  131. gcore/types/streaming/stream.py +420 -0
  132. gcore/types/streaming/stream_create_clip_params.py +48 -0
  133. gcore/types/streaming/stream_create_params.py +165 -0
  134. gcore/types/streaming/stream_list_clips_response.py +10 -0
  135. gcore/types/streaming/stream_list_params.py +18 -0
  136. gcore/types/streaming/stream_series.py +21 -0
  137. gcore/types/streaming/stream_start_recording_response.py +76 -0
  138. gcore/types/streaming/stream_update_params.py +169 -0
  139. gcore/types/streaming/streams/__init__.py +11 -0
  140. gcore/types/streaming/streams/overlay.py +43 -0
  141. gcore/types/streaming/streams/overlay_create_params.py +36 -0
  142. gcore/types/streaming/streams/overlay_create_response.py +10 -0
  143. gcore/types/streaming/streams/overlay_list_response.py +10 -0
  144. gcore/types/streaming/streams/overlay_update_multiple_params.py +39 -0
  145. gcore/types/streaming/streams/overlay_update_multiple_response.py +10 -0
  146. gcore/types/streaming/streams/overlay_update_params.py +33 -0
  147. gcore/types/streaming/subtitle.py +12 -0
  148. gcore/types/streaming/subtitle_base.py +18 -0
  149. gcore/types/streaming/subtitle_base_param.py +18 -0
  150. gcore/types/streaming/unique_viewers.py +35 -0
  151. gcore/types/streaming/unique_viewers_cdn.py +17 -0
  152. gcore/types/streaming/video.py +444 -0
  153. gcore/types/streaming/video_create_multiple_params.py +28 -0
  154. gcore/types/streaming/video_create_multiple_response.py +10 -0
  155. gcore/types/streaming/video_create_params.py +13 -0
  156. gcore/types/streaming/video_create_response.py +10 -0
  157. gcore/types/streaming/video_list_names_params.py +13 -0
  158. gcore/types/streaming/video_list_params.py +59 -0
  159. gcore/types/streaming/video_update_params.py +214 -0
  160. gcore/types/streaming/videos/__init__.py +7 -0
  161. gcore/types/streaming/videos/subtitle_create_params.py +17 -0
  162. gcore/types/streaming/videos/subtitle_list_response.py +10 -0
  163. gcore/types/streaming/videos/subtitle_update_params.py +20 -0
  164. gcore/types/streaming/views.py +35 -0
  165. gcore/types/streaming/views_by_browser.py +17 -0
  166. gcore/types/streaming/views_by_country.py +19 -0
  167. gcore/types/streaming/views_by_hostname.py +17 -0
  168. gcore/types/streaming/views_by_operating_system.py +17 -0
  169. gcore/types/streaming/views_by_referer.py +17 -0
  170. gcore/types/streaming/views_by_region.py +19 -0
  171. gcore/types/streaming/views_heatmap.py +19 -0
  172. gcore/types/streaming/vod_statistics_series.py +21 -0
  173. gcore/types/streaming/vod_total_stream_duration_series.py +22 -0
  174. gcore/types/waap/domains/custom_rule_create_params.py +4 -4
  175. gcore/types/waap/domains/custom_rule_update_params.py +4 -4
  176. gcore/types/waap/ip_info_get_blocked_requests_params.py +5 -1
  177. gcore/types/waap/ip_info_get_counts_params.py +2 -1
  178. gcore/types/waap/ip_info_get_top_sessions_params.py +5 -1
  179. gcore/types/waap/ip_info_get_top_urls_params.py +5 -1
  180. gcore/types/waap/ip_info_get_top_user_agents_params.py +5 -1
  181. gcore/types/waap/waap_custom_rule.py +4 -4
  182. {gcore-0.6.0.dist-info → gcore-0.8.0.dist-info}/METADATA +1 -1
  183. {gcore-0.6.0.dist-info → gcore-0.8.0.dist-info}/RECORD +185 -37
  184. {gcore-0.6.0.dist-info → gcore-0.8.0.dist-info}/WHEEL +0 -0
  185. {gcore-0.6.0.dist-info → gcore-0.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,1592 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Iterable
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from .overlays import (
11
+ OverlaysResource,
12
+ AsyncOverlaysResource,
13
+ OverlaysResourceWithRawResponse,
14
+ AsyncOverlaysResourceWithRawResponse,
15
+ OverlaysResourceWithStreamingResponse,
16
+ AsyncOverlaysResourceWithStreamingResponse,
17
+ )
18
+ from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
19
+ from ...._utils import maybe_transform, async_maybe_transform
20
+ from ...._compat import cached_property
21
+ from ...._resource import SyncAPIResource, AsyncAPIResource
22
+ from ...._response import (
23
+ to_raw_response_wrapper,
24
+ to_streamed_response_wrapper,
25
+ async_to_raw_response_wrapper,
26
+ async_to_streamed_response_wrapper,
27
+ )
28
+ from ....pagination import SyncPageStreaming, AsyncPageStreaming
29
+ from ...._base_client import AsyncPaginator, make_request_options
30
+ from ....types.streaming import (
31
+ stream_list_params,
32
+ stream_create_params,
33
+ stream_update_params,
34
+ stream_create_clip_params,
35
+ )
36
+ from ....types.streaming.clip import Clip
37
+ from ....types.streaming.video import Video
38
+ from ....types.streaming.stream import Stream
39
+ from ....types.streaming.stream_list_clips_response import StreamListClipsResponse
40
+ from ....types.streaming.stream_start_recording_response import StreamStartRecordingResponse
41
+
42
+ __all__ = ["StreamsResource", "AsyncStreamsResource"]
43
+
44
+
45
+ class StreamsResource(SyncAPIResource):
46
+ @cached_property
47
+ def overlays(self) -> OverlaysResource:
48
+ return OverlaysResource(self._client)
49
+
50
+ @cached_property
51
+ def with_raw_response(self) -> StreamsResourceWithRawResponse:
52
+ """
53
+ This property can be used as a prefix for any HTTP method call to return
54
+ the raw response object instead of the parsed content.
55
+
56
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
57
+ """
58
+ return StreamsResourceWithRawResponse(self)
59
+
60
+ @cached_property
61
+ def with_streaming_response(self) -> StreamsResourceWithStreamingResponse:
62
+ """
63
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
64
+
65
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
66
+ """
67
+ return StreamsResourceWithStreamingResponse(self)
68
+
69
+ def create(
70
+ self,
71
+ *,
72
+ name: str,
73
+ active: bool | NotGiven = NOT_GIVEN,
74
+ auto_record: bool | NotGiven = NOT_GIVEN,
75
+ broadcast_ids: Iterable[int] | NotGiven = NOT_GIVEN,
76
+ cdn_id: int | NotGiven = NOT_GIVEN,
77
+ client_entity_data: str | NotGiven = NOT_GIVEN,
78
+ client_user_id: int | NotGiven = NOT_GIVEN,
79
+ dvr_duration: int | NotGiven = NOT_GIVEN,
80
+ dvr_enabled: bool | NotGiven = NOT_GIVEN,
81
+ hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN,
82
+ html_overlay: bool | NotGiven = NOT_GIVEN,
83
+ low_latency_enabled: bool | NotGiven = NOT_GIVEN,
84
+ projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN,
85
+ pull: bool | NotGiven = NOT_GIVEN,
86
+ quality_set_id: int | NotGiven = NOT_GIVEN,
87
+ record_type: Literal["origin", "transcoded"] | NotGiven = NOT_GIVEN,
88
+ uri: str | NotGiven = NOT_GIVEN,
89
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
90
+ # The extra values given here take precedence over values defined on the client or passed to this method.
91
+ extra_headers: Headers | None = None,
92
+ extra_query: Query | None = None,
93
+ extra_body: Body | None = None,
94
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
95
+ ) -> Stream:
96
+ """
97
+ Use this method to create a new live stream entity for broadcasting.
98
+
99
+ The input in API may contain streams of different formats, including the most
100
+ common ones RTMP, RTMPS, SRT, HLS. Note that multicast MPEG-TS over UDP and
101
+ others are supported too, ask the Support Team please. For ingestion, you can
102
+ use both PUSH and PULL methods. Also you can use the main and backup servers,
103
+ which are geographically located in different locations. By default, any free
104
+ ingest points in the world are used. Settings have been applied that deliver
105
+ low-latency streams in the optimal way. If for some reason you need to set a
106
+ fixed ingest point, or if you need to set the main and backup ingest points in
107
+ the same region (for example, do not send streams outside the EU or US), then
108
+ contact our Support Team.
109
+
110
+ The output is HLS and MPEG-DASH with ABR. We transcode video for you by our
111
+ cloud-based infrastructure. ABR ladder supports all qualities from SD to 8K HDR
112
+ 60fps. All our streams are Low Latency enabled. We support a delay of ±4 seconds
113
+ for video streams by utilizing Common Media Application Format (CMAF)
114
+ technology. So you obtain latency from the traditional 30-50 seconds to ±4
115
+ seconds only by default. If you need legacy non-low-latency HLS, then look at
116
+ HLS MPEGTS delivery below.
117
+
118
+ You have access to additional functions such as:
119
+
120
+ - DVR
121
+ - Recording
122
+ - Live clipping
123
+ - Restreaming
124
+ - (soon) AI Automatic Speech Recognition for subtitles/captions generating
125
+
126
+ For more information see specific API methods, and the Knowledge Base. To
127
+ organize streaming with ultra-low latency, look for WebRTC delivery in different
128
+ section in the Knowledge Base.
129
+ ![HTML Overlays](https://demo-files.gvideo.io/apidocs/low-latency-football.gif)
130
+
131
+ Args:
132
+ name: Stream name. Often used as a human-readable name for the stream, but can contain
133
+ any text you wish. The values are not unique and may be repeated. Examples:
134
+
135
+ - Conference in July
136
+ - Stream #10003
137
+ - Open-Air Camera #31 Backstage
138
+ - 480fd499-2de2-4988-bc1a-a4eebe9818ee
139
+
140
+ active: Stream switch between on and off. This is not an indicator of the status "stream
141
+ is receiving and it is LIVE", but rather an on/off switch. When stream is
142
+ switched off, there is no way to process it: PULL is deactivated and PUSH will
143
+ return an error.
144
+
145
+ - true – stream can be processed
146
+ - false – stream is off, and cannot be processed
147
+
148
+ auto_record: Enables autotomatic recording of the stream when it started. So you don't need
149
+ to call recording manually. Result of recording is automatically added to video
150
+ hosting. For details see the /streams/`start_recording` method and in knowledge
151
+ base Values:
152
+
153
+ - true – auto recording is enabled
154
+ - false – auto recording is disabled
155
+
156
+ broadcast_ids: IDs of broadcasts which will include this stream
157
+
158
+ cdn_id: ID of custom CDN resource from which the content will be delivered (only if you
159
+ know what you do)
160
+
161
+ client_entity_data: Custom meta field designed to store your own extra information about a video
162
+ entity: video source, video id, parameters, etc. We do not use this field in any
163
+ way when processing the stream. You can store any data in any format (string,
164
+ json, etc), saved as a text string. Example:
165
+ `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' ``
166
+
167
+ client_user_id: Custom meta field for storing the Identifier in your system. We do not use this
168
+ field in any way when processing the stream. Example: `client_user_id = 1001`
169
+
170
+ dvr_duration: DVR duration in seconds if DVR feature is enabled for the stream. So this is
171
+ duration of how far the user can rewind the live stream. `dvr_duration` range is
172
+ [30...14400]. Maximum value is 4 hours = 14400 seconds. If you need more, ask
173
+ the Support Team please.
174
+
175
+ dvr_enabled:
176
+ Enables DVR for the stream:
177
+
178
+ - true – DVR is enabled
179
+ - false – DVR is disabled
180
+
181
+ hls_mpegts_endlist_tag: Add `#EXT-X-ENDLIST` tag within .m3u8 playlist after the last segment of a live
182
+ stream when broadcast is ended.
183
+
184
+ html_overlay: Switch on mode to insert and display real-time HTML overlay widgets on top of
185
+ live streams
186
+
187
+ low_latency_enabled: Deprecated, always returns "true". The only exception is that the attribute can
188
+ only be used by clients that have previously used the old stream format. This
189
+ method is outdated since we've made it easier to manage streams. For your
190
+ convenience, you no longer need to set this parameter at the stage of creating a
191
+ stream. Now all streams are prepared in 2 formats simultaniously: Low Latency
192
+ and Legacy. You can get the desired output format in the attributes
193
+ "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once.
194
+
195
+ ---
196
+
197
+ Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the
198
+ "`hls_mpegts_url`" attribute instead.
199
+
200
+ projection: Visualization mode for 360° streams, how the stream is rendered in our web
201
+ player ONLY. If you would like to show video 360° in an external video player,
202
+ then use parameters of that video player. Modes:
203
+
204
+ - regular – regular “flat” stream
205
+ - vr360 – display stream in 360° mode
206
+ - vr180 – display stream in 180° mode
207
+ - vr360tb – display stream in 3D 360° mode Top-Bottom
208
+
209
+ pull: Indicates if stream is pulled from external server or not. Has two possible
210
+ values:
211
+
212
+ - true – stream is received by PULL method. Use this when need to get stream
213
+ from external server by srt, rtmp\\ss, hls, dash, etc protocols.
214
+ - false – stream is received by PUSH method. Use this when need to send stream
215
+ from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio.
216
+
217
+ quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to
218
+ your conditions. Look at GET /`quality_sets` method
219
+
220
+ record_type: Method of recording a stream. Specifies the source from which the stream will be
221
+ recorded: original or transcoded. Types:
222
+
223
+ - "origin" – To record RMTP/SRT/etc original clean media source.
224
+ - "transcoded" – To record the output transcoded version of the stream,
225
+ including overlays, texts, logos, etc. additional media layers.
226
+
227
+ uri: When using PULL method, this is the URL to pull a stream from. You can specify
228
+ multiple addresses separated by a space (" "), so you can organize a backup
229
+ plan. In this case, the specified addresses will be selected one by one using
230
+ round robin scheduling. If the first address does not respond, then the next one
231
+ in the list will be automatically requested, returning to the first and so on in
232
+ a circle. Also, if the sucessfully working stream stops sending data, then the
233
+ next one will be selected according to the same scheme. After 24 hours of
234
+ inactivity of your streams we will stop PULL-ing, and will switch "active" field
235
+ to "false". Please, note that this field is for PULL only, so is not suitable
236
+ for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method.
237
+
238
+ extra_headers: Send extra headers
239
+
240
+ extra_query: Add additional query parameters to the request
241
+
242
+ extra_body: Add additional JSON properties to the request
243
+
244
+ timeout: Override the client-level default timeout for this request, in seconds
245
+ """
246
+ return self._post(
247
+ "/streaming/streams",
248
+ body=maybe_transform(
249
+ {
250
+ "name": name,
251
+ "active": active,
252
+ "auto_record": auto_record,
253
+ "broadcast_ids": broadcast_ids,
254
+ "cdn_id": cdn_id,
255
+ "client_entity_data": client_entity_data,
256
+ "client_user_id": client_user_id,
257
+ "dvr_duration": dvr_duration,
258
+ "dvr_enabled": dvr_enabled,
259
+ "hls_mpegts_endlist_tag": hls_mpegts_endlist_tag,
260
+ "html_overlay": html_overlay,
261
+ "low_latency_enabled": low_latency_enabled,
262
+ "projection": projection,
263
+ "pull": pull,
264
+ "quality_set_id": quality_set_id,
265
+ "record_type": record_type,
266
+ "uri": uri,
267
+ },
268
+ stream_create_params.StreamCreateParams,
269
+ ),
270
+ options=make_request_options(
271
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
272
+ ),
273
+ cast_to=Stream,
274
+ )
275
+
276
+ def update(
277
+ self,
278
+ stream_id: int,
279
+ *,
280
+ stream: stream_update_params.Stream | NotGiven = NOT_GIVEN,
281
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
282
+ # The extra values given here take precedence over values defined on the client or passed to this method.
283
+ extra_headers: Headers | None = None,
284
+ extra_query: Query | None = None,
285
+ extra_body: Body | None = None,
286
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
287
+ ) -> Stream:
288
+ """
289
+ Updates stream settings
290
+
291
+ Args:
292
+ extra_headers: Send extra headers
293
+
294
+ extra_query: Add additional query parameters to the request
295
+
296
+ extra_body: Add additional JSON properties to the request
297
+
298
+ timeout: Override the client-level default timeout for this request, in seconds
299
+ """
300
+ return self._patch(
301
+ f"/streaming/streams/{stream_id}",
302
+ body=maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams),
303
+ options=make_request_options(
304
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
305
+ ),
306
+ cast_to=Stream,
307
+ )
308
+
309
+ def list(
310
+ self,
311
+ *,
312
+ page: int | NotGiven = NOT_GIVEN,
313
+ with_broadcasts: int | NotGiven = NOT_GIVEN,
314
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
315
+ # The extra values given here take precedence over values defined on the client or passed to this method.
316
+ extra_headers: Headers | None = None,
317
+ extra_query: Query | None = None,
318
+ extra_body: Body | None = None,
319
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
320
+ ) -> SyncPageStreaming[Stream]:
321
+ """Returns a list of streams.
322
+
323
+ Args:
324
+ page: Query parameter.
325
+
326
+ Use it to list the paginated content
327
+
328
+ with_broadcasts: Query parameter. Set to 1 to get details of the broadcasts associated with the
329
+ stream
330
+
331
+ extra_headers: Send extra headers
332
+
333
+ extra_query: Add additional query parameters to the request
334
+
335
+ extra_body: Add additional JSON properties to the request
336
+
337
+ timeout: Override the client-level default timeout for this request, in seconds
338
+ """
339
+ return self._get_api_list(
340
+ "/streaming/streams",
341
+ page=SyncPageStreaming[Stream],
342
+ options=make_request_options(
343
+ extra_headers=extra_headers,
344
+ extra_query=extra_query,
345
+ extra_body=extra_body,
346
+ timeout=timeout,
347
+ query=maybe_transform(
348
+ {
349
+ "page": page,
350
+ "with_broadcasts": with_broadcasts,
351
+ },
352
+ stream_list_params.StreamListParams,
353
+ ),
354
+ ),
355
+ model=Stream,
356
+ )
357
+
358
+ def delete(
359
+ self,
360
+ stream_id: int,
361
+ *,
362
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
363
+ # The extra values given here take precedence over values defined on the client or passed to this method.
364
+ extra_headers: Headers | None = None,
365
+ extra_query: Query | None = None,
366
+ extra_body: Body | None = None,
367
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
368
+ ) -> None:
369
+ """
370
+ Delete a live stream.
371
+
372
+ After deleting the live stream, all associated data is deleted: settings, PUSH
373
+ and PULL links, video playback links, etc. Live stream information is deleted
374
+ permanently and irreversibly. Therefore, it is impossible to restore data and
375
+ files after this. But if the live had recordings, they continue to remain
376
+ independent Video entities. The "`stream_id`" parameter will simply point to a
377
+ stream that no longer exists.
378
+
379
+ Perhaps, instead of deleting, you may use the stream deactivation:
380
+
381
+ ```
382
+ PATCH /videos/{`stream_id`}
383
+ { "active": false }
384
+ ```
385
+
386
+ For details, see the Product Documentation.
387
+
388
+ Args:
389
+ extra_headers: Send extra headers
390
+
391
+ extra_query: Add additional query parameters to the request
392
+
393
+ extra_body: Add additional JSON properties to the request
394
+
395
+ timeout: Override the client-level default timeout for this request, in seconds
396
+ """
397
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
398
+ return self._delete(
399
+ f"/streaming/streams/{stream_id}",
400
+ options=make_request_options(
401
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
402
+ ),
403
+ cast_to=NoneType,
404
+ )
405
+
406
+ def clear_dvr(
407
+ self,
408
+ stream_id: int,
409
+ *,
410
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
411
+ # The extra values given here take precedence over values defined on the client or passed to this method.
412
+ extra_headers: Headers | None = None,
413
+ extra_query: Query | None = None,
414
+ extra_body: Body | None = None,
415
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
416
+ ) -> None:
417
+ """
418
+ Clear live stream DVR
419
+
420
+ Args:
421
+ extra_headers: Send extra headers
422
+
423
+ extra_query: Add additional query parameters to the request
424
+
425
+ extra_body: Add additional JSON properties to the request
426
+
427
+ timeout: Override the client-level default timeout for this request, in seconds
428
+ """
429
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
430
+ return self._put(
431
+ f"/streaming/streams/{stream_id}/dvr_cleanup",
432
+ options=make_request_options(
433
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
434
+ ),
435
+ cast_to=NoneType,
436
+ )
437
+
438
+ def create_clip(
439
+ self,
440
+ stream_id: int,
441
+ *,
442
+ duration: int,
443
+ expiration: int | NotGiven = NOT_GIVEN,
444
+ start: int | NotGiven = NOT_GIVEN,
445
+ vod_required: bool | NotGiven = NOT_GIVEN,
446
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
447
+ # The extra values given here take precedence over values defined on the client or passed to this method.
448
+ extra_headers: Headers | None = None,
449
+ extra_query: Query | None = None,
450
+ extra_body: Body | None = None,
451
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
452
+ ) -> Clip:
453
+ """Create an instant clip from on-going live stream.
454
+
455
+ Instant clips are applicable
456
+ in cases where there is no time to wait for the broadcast to be completed and
457
+ recorded. For example, for quickly cutting highlights in sport events, or
458
+ cutting an important moment in the news or live performance.
459
+
460
+ Instant clip becomes available for viewing in the following formats:
461
+
462
+ - HLS .m3u8,
463
+ - MP4,
464
+ - VOD in video hosting with a permanent link to watch video.
465
+ ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`clip_recording_mp4_hls`.gif)
466
+
467
+ **Clip lifetime:** Instant clips are a copy of the stream, created from a live
468
+ stream. They are stored in memory for a limited time, after which the clip
469
+ ceases to exist and you will receive a 404 on the link. Limits that you should
470
+ keep in mind:
471
+
472
+ - The clip's lifespan is controlled by `expiration` parameter.
473
+ - The default expiration value is 1 hour. The value can be set from 1 minute to
474
+ 4 hours.
475
+ - If you want a video for longer or permanent viewing, then create a regular VOD
476
+ based on the clip. This way you can use the clip's link for the first time,
477
+ and immediately after the transcoded version is ready, you can change by
478
+ yourself it to a permanent link of VOD.
479
+ - The clip becomes available only after it is completely copied from the live
480
+ stream. So the clip will be available after `start + duration` exact time. If
481
+ you try to request it before this time, the response will be error code 425
482
+ "Too Early".
483
+
484
+ **Cutting a clip from a source:** In order to use clips recording feature, DVR
485
+ must be enabled for a stream: "`dvr_enabled`: true". The DVR serves as a source
486
+ for creating clips:
487
+
488
+ - By default live stream DVR is set to 1 hour (3600 seconds). You can create an
489
+ instant clip using any segment of this time period by specifying the desired
490
+ start time and duration.
491
+ - If you create a clip, but the DVR expires, the clip will still exist for the
492
+ specified time as a copy of the stream.
493
+
494
+ **Getting permanent VOD:** To get permanent VOD version of a live clip use this
495
+ parameter when making a request to create a clip: `vod_required: true`. Later,
496
+ when the clip is ready, grab `video_id` value from the response and query the
497
+ video by regular GET /video/{id} method.
498
+
499
+ Args:
500
+ duration: Requested segment duration in seconds to be cut. Please, note that cutting is
501
+ based on the idea of instantly creating a clip, instead of precise timing. So
502
+ final segment may be:
503
+
504
+ - Less than the specified value if there is less data in the DVR than the
505
+ requested segment.
506
+ - Greater than the specified value, because segment is aligned to the first and
507
+ last key frames of already stored fragment in DVR, this way -1 and +1 chunks
508
+ can be added to left and right. Duration of cutted segment cannot be greater
509
+ than DVR duration for this stream. Therefore, to change the maximum, use
510
+ "`dvr_duration`" parameter of this stream.
511
+
512
+ expiration: Expire time of the clip via a public link. Unix timestamp in seconds, absolute
513
+ value. This is the time how long the instant clip will be stored in the server
514
+ memory and can be accessed via public HLS/MP4 links. Download and/or use the
515
+ instant clip before this time expires. After the time has expired, the clip is
516
+ deleted from memory and is no longer available via the link. You need to create
517
+ a new segment, or use `vod_required: true` attribute. If value is omitted, then
518
+ expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e.
519
+ `unix timestamp = + + 3600`). Allowed range: 1m <= expiration <= 4h. Example:
520
+ `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860`
521
+
522
+ start: Starting point of the segment to cut. Unix timestamp in seconds, absolute value.
523
+ Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value
524
+ from the past is specified, it is used as the starting point for the segment to
525
+ cut. If the value is omitted, then clip will start from now.
526
+
527
+ vod_required: Indicates if video needs to be stored also as permanent VOD
528
+
529
+ extra_headers: Send extra headers
530
+
531
+ extra_query: Add additional query parameters to the request
532
+
533
+ extra_body: Add additional JSON properties to the request
534
+
535
+ timeout: Override the client-level default timeout for this request, in seconds
536
+ """
537
+ return self._put(
538
+ f"/streaming/streams/{stream_id}/clip_recording",
539
+ body=maybe_transform(
540
+ {
541
+ "duration": duration,
542
+ "expiration": expiration,
543
+ "start": start,
544
+ "vod_required": vod_required,
545
+ },
546
+ stream_create_clip_params.StreamCreateClipParams,
547
+ ),
548
+ options=make_request_options(
549
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
550
+ ),
551
+ cast_to=Clip,
552
+ )
553
+
554
+ def get(
555
+ self,
556
+ stream_id: int,
557
+ *,
558
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
559
+ # The extra values given here take precedence over values defined on the client or passed to this method.
560
+ extra_headers: Headers | None = None,
561
+ extra_query: Query | None = None,
562
+ extra_body: Body | None = None,
563
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
564
+ ) -> Stream:
565
+ """
566
+ Returns stream details
567
+
568
+ Args:
569
+ extra_headers: Send extra headers
570
+
571
+ extra_query: Add additional query parameters to the request
572
+
573
+ extra_body: Add additional JSON properties to the request
574
+
575
+ timeout: Override the client-level default timeout for this request, in seconds
576
+ """
577
+ return self._get(
578
+ f"/streaming/streams/{stream_id}",
579
+ options=make_request_options(
580
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
581
+ ),
582
+ cast_to=Stream,
583
+ )
584
+
585
+ def list_clips(
586
+ self,
587
+ stream_id: int,
588
+ *,
589
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
590
+ # The extra values given here take precedence over values defined on the client or passed to this method.
591
+ extra_headers: Headers | None = None,
592
+ extra_query: Query | None = None,
593
+ extra_body: Body | None = None,
594
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
595
+ ) -> StreamListClipsResponse:
596
+ """
597
+ Get list of non expired instant clips for a stream.
598
+
599
+ You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs
600
+ from "`hls_master`" and "`mp4_master`".
601
+
602
+ **How to download renditions of clips:** URLs contain "master" alias by default,
603
+ which means maximum available quality from ABR set (based on height metadata).
604
+ There is also possibility to access individual bitrates from ABR ladder. That
605
+ works for both HLS and MP4. You can replace manually "master" to a value from
606
+ renditions list in order to get exact bitrate/quality from the set. Example:
607
+
608
+ - HLS 720p:
609
+ `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.m3u8 ``
610
+ - HLS 720p:
611
+ `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.m3u8 ``
612
+ - MP4 360p:
613
+ `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.mp4 ``
614
+ - MP4 360p:
615
+ `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.mp4 ``
616
+
617
+ Args:
618
+ extra_headers: Send extra headers
619
+
620
+ extra_query: Add additional query parameters to the request
621
+
622
+ extra_body: Add additional JSON properties to the request
623
+
624
+ timeout: Override the client-level default timeout for this request, in seconds
625
+ """
626
+ return self._get(
627
+ f"/streaming/streams/{stream_id}/clip_recording",
628
+ options=make_request_options(
629
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
630
+ ),
631
+ cast_to=StreamListClipsResponse,
632
+ )
633
+
634
+ def start_recording(
635
+ self,
636
+ stream_id: int,
637
+ *,
638
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
639
+ # The extra values given here take precedence over values defined on the client or passed to this method.
640
+ extra_headers: Headers | None = None,
641
+ extra_query: Query | None = None,
642
+ extra_body: Body | None = None,
643
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
644
+ ) -> StreamStartRecordingResponse:
645
+ """
646
+ Start recording a stream.
647
+
648
+ Stream will be recorded and automatically saved in our video hosting as a
649
+ separate video VOD:
650
+
651
+ - ID of the stream from which the recording was organized is added to
652
+ "`stream_id`" field. You can find the video by that value later.
653
+ - Title of the video is based on pattern "Stream Record: {`stream_title`},
654
+ {`recording_end_time_utc`}".
655
+ - Recording start time is stored in "`recording_started_at`" field.
656
+ - You can record the original stream or the transcoded one. Only the transcoded
657
+ version will contain overlays. Set the appropriate recording method when
658
+ creating the stream or before calling this recording method. Details in the
659
+ "`record_type`" parameter of the stream.
660
+ - If you have access to the premium feature of saving the original stream (so
661
+ not just transcoded renditions), then the link to the original file will be in
662
+ the "`origin_url`" field. Look at the description of the field how to use it.
663
+ Stream must be live for the recording to start, please check fields "live"
664
+ and/or "`backup_live`". After the recording starts, field "recording" will
665
+ switch to "true", and the recording duration in seconds will appear in the
666
+ "`recording_duration`" field. Please, keep in mind that recording doesn't
667
+ start instantly, it takes ±3-7 seconds to initialize the process after
668
+ executing this method.
669
+
670
+ Stream recording stops when:
671
+
672
+ - Explicit execution of the method /`stop_recording`. In this case, the file
673
+ will be completely saved and closed. When you execute the stream recording
674
+ method again, the recording will be made to a new video file.
675
+ - When sending the stream stops on the client side, or stops accidentally. In
676
+ this case, recording process is waiting for 10 seconds to resume recording:
677
+ - If the stream resumes within that period, recording will continue to the same
678
+ file.
679
+ - After that period, the file will be completely saved and closed.
680
+ - If the stream suddenly resumes after this period, the recording will go to a
681
+ new file, because old file is closed already. Please, also note that if you
682
+ have long broadcasts, the recording will be cut into 4-hour videos. This value
683
+ is fixed, but can be changed upon request to the Support Team.
684
+
685
+ Args:
686
+ extra_headers: Send extra headers
687
+
688
+ extra_query: Add additional query parameters to the request
689
+
690
+ extra_body: Add additional JSON properties to the request
691
+
692
+ timeout: Override the client-level default timeout for this request, in seconds
693
+ """
694
+ return self._put(
695
+ f"/streaming/streams/{stream_id}/start_recording",
696
+ options=make_request_options(
697
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
698
+ ),
699
+ cast_to=StreamStartRecordingResponse,
700
+ )
701
+
702
+ def stop_recording(
703
+ self,
704
+ stream_id: int,
705
+ *,
706
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
707
+ # The extra values given here take precedence over values defined on the client or passed to this method.
708
+ extra_headers: Headers | None = None,
709
+ extra_query: Query | None = None,
710
+ extra_body: Body | None = None,
711
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
712
+ ) -> Video:
713
+ """
714
+ Stop recording a stream.
715
+
716
+ Stream must be in "recording: true" state for recording to be stopped.
717
+
718
+ If there was a recording, the created video entity will be returned. Otherwise
719
+ the response will be empty. Please see conditions and restrictions for recording
720
+ a stream in the description of method /`start_recording`.
721
+
722
+ Args:
723
+ extra_headers: Send extra headers
724
+
725
+ extra_query: Add additional query parameters to the request
726
+
727
+ extra_body: Add additional JSON properties to the request
728
+
729
+ timeout: Override the client-level default timeout for this request, in seconds
730
+ """
731
+ return self._put(
732
+ f"/streaming/streams/{stream_id}/stop_recording",
733
+ options=make_request_options(
734
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
735
+ ),
736
+ cast_to=Video,
737
+ )
738
+
739
+
740
+ class AsyncStreamsResource(AsyncAPIResource):
741
+ @cached_property
742
+ def overlays(self) -> AsyncOverlaysResource:
743
+ return AsyncOverlaysResource(self._client)
744
+
745
+ @cached_property
746
+ def with_raw_response(self) -> AsyncStreamsResourceWithRawResponse:
747
+ """
748
+ This property can be used as a prefix for any HTTP method call to return
749
+ the raw response object instead of the parsed content.
750
+
751
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
752
+ """
753
+ return AsyncStreamsResourceWithRawResponse(self)
754
+
755
+ @cached_property
756
+ def with_streaming_response(self) -> AsyncStreamsResourceWithStreamingResponse:
757
+ """
758
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
759
+
760
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
761
+ """
762
+ return AsyncStreamsResourceWithStreamingResponse(self)
763
+
764
+ async def create(
765
+ self,
766
+ *,
767
+ name: str,
768
+ active: bool | NotGiven = NOT_GIVEN,
769
+ auto_record: bool | NotGiven = NOT_GIVEN,
770
+ broadcast_ids: Iterable[int] | NotGiven = NOT_GIVEN,
771
+ cdn_id: int | NotGiven = NOT_GIVEN,
772
+ client_entity_data: str | NotGiven = NOT_GIVEN,
773
+ client_user_id: int | NotGiven = NOT_GIVEN,
774
+ dvr_duration: int | NotGiven = NOT_GIVEN,
775
+ dvr_enabled: bool | NotGiven = NOT_GIVEN,
776
+ hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN,
777
+ html_overlay: bool | NotGiven = NOT_GIVEN,
778
+ low_latency_enabled: bool | NotGiven = NOT_GIVEN,
779
+ projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN,
780
+ pull: bool | NotGiven = NOT_GIVEN,
781
+ quality_set_id: int | NotGiven = NOT_GIVEN,
782
+ record_type: Literal["origin", "transcoded"] | NotGiven = NOT_GIVEN,
783
+ uri: str | NotGiven = NOT_GIVEN,
784
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
785
+ # The extra values given here take precedence over values defined on the client or passed to this method.
786
+ extra_headers: Headers | None = None,
787
+ extra_query: Query | None = None,
788
+ extra_body: Body | None = None,
789
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
790
+ ) -> Stream:
791
+ """
792
+ Use this method to create a new live stream entity for broadcasting.
793
+
794
+ The input in API may contain streams of different formats, including the most
795
+ common ones RTMP, RTMPS, SRT, HLS. Note that multicast MPEG-TS over UDP and
796
+ others are supported too, ask the Support Team please. For ingestion, you can
797
+ use both PUSH and PULL methods. Also you can use the main and backup servers,
798
+ which are geographically located in different locations. By default, any free
799
+ ingest points in the world are used. Settings have been applied that deliver
800
+ low-latency streams in the optimal way. If for some reason you need to set a
801
+ fixed ingest point, or if you need to set the main and backup ingest points in
802
+ the same region (for example, do not send streams outside the EU or US), then
803
+ contact our Support Team.
804
+
805
+ The output is HLS and MPEG-DASH with ABR. We transcode video for you by our
806
+ cloud-based infrastructure. ABR ladder supports all qualities from SD to 8K HDR
807
+ 60fps. All our streams are Low Latency enabled. We support a delay of ±4 seconds
808
+ for video streams by utilizing Common Media Application Format (CMAF)
809
+ technology. So you obtain latency from the traditional 30-50 seconds to ±4
810
+ seconds only by default. If you need legacy non-low-latency HLS, then look at
811
+ HLS MPEGTS delivery below.
812
+
813
+ You have access to additional functions such as:
814
+
815
+ - DVR
816
+ - Recording
817
+ - Live clipping
818
+ - Restreaming
819
+ - (soon) AI Automatic Speech Recognition for subtitles/captions generating
820
+
821
+ For more information see specific API methods, and the Knowledge Base. To
822
+ organize streaming with ultra-low latency, look for WebRTC delivery in different
823
+ section in the Knowledge Base.
824
+ ![HTML Overlays](https://demo-files.gvideo.io/apidocs/low-latency-football.gif)
825
+
826
+ Args:
827
+ name: Stream name. Often used as a human-readable name for the stream, but can contain
828
+ any text you wish. The values are not unique and may be repeated. Examples:
829
+
830
+ - Conference in July
831
+ - Stream #10003
832
+ - Open-Air Camera #31 Backstage
833
+ - 480fd499-2de2-4988-bc1a-a4eebe9818ee
834
+
835
+ active: Stream switch between on and off. This is not an indicator of the status "stream
836
+ is receiving and it is LIVE", but rather an on/off switch. When stream is
837
+ switched off, there is no way to process it: PULL is deactivated and PUSH will
838
+ return an error.
839
+
840
+ - true – stream can be processed
841
+ - false – stream is off, and cannot be processed
842
+
843
+ auto_record: Enables autotomatic recording of the stream when it started. So you don't need
844
+ to call recording manually. Result of recording is automatically added to video
845
+ hosting. For details see the /streams/`start_recording` method and in knowledge
846
+ base Values:
847
+
848
+ - true – auto recording is enabled
849
+ - false – auto recording is disabled
850
+
851
+ broadcast_ids: IDs of broadcasts which will include this stream
852
+
853
+ cdn_id: ID of custom CDN resource from which the content will be delivered (only if you
854
+ know what you do)
855
+
856
+ client_entity_data: Custom meta field designed to store your own extra information about a video
857
+ entity: video source, video id, parameters, etc. We do not use this field in any
858
+ way when processing the stream. You can store any data in any format (string,
859
+ json, etc), saved as a text string. Example:
860
+ `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' ``
861
+
862
+ client_user_id: Custom meta field for storing the Identifier in your system. We do not use this
863
+ field in any way when processing the stream. Example: `client_user_id = 1001`
864
+
865
+ dvr_duration: DVR duration in seconds if DVR feature is enabled for the stream. So this is
866
+ duration of how far the user can rewind the live stream. `dvr_duration` range is
867
+ [30...14400]. Maximum value is 4 hours = 14400 seconds. If you need more, ask
868
+ the Support Team please.
869
+
870
+ dvr_enabled:
871
+ Enables DVR for the stream:
872
+
873
+ - true – DVR is enabled
874
+ - false – DVR is disabled
875
+
876
+ hls_mpegts_endlist_tag: Add `#EXT-X-ENDLIST` tag within .m3u8 playlist after the last segment of a live
877
+ stream when broadcast is ended.
878
+
879
+ html_overlay: Switch on mode to insert and display real-time HTML overlay widgets on top of
880
+ live streams
881
+
882
+ low_latency_enabled: Deprecated, always returns "true". The only exception is that the attribute can
883
+ only be used by clients that have previously used the old stream format. This
884
+ method is outdated since we've made it easier to manage streams. For your
885
+ convenience, you no longer need to set this parameter at the stage of creating a
886
+ stream. Now all streams are prepared in 2 formats simultaniously: Low Latency
887
+ and Legacy. You can get the desired output format in the attributes
888
+ "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once.
889
+
890
+ ---
891
+
892
+ Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the
893
+ "`hls_mpegts_url`" attribute instead.
894
+
895
+ projection: Visualization mode for 360° streams, how the stream is rendered in our web
896
+ player ONLY. If you would like to show video 360° in an external video player,
897
+ then use parameters of that video player. Modes:
898
+
899
+ - regular – regular “flat” stream
900
+ - vr360 – display stream in 360° mode
901
+ - vr180 – display stream in 180° mode
902
+ - vr360tb – display stream in 3D 360° mode Top-Bottom
903
+
904
+ pull: Indicates if stream is pulled from external server or not. Has two possible
905
+ values:
906
+
907
+ - true – stream is received by PULL method. Use this when need to get stream
908
+ from external server by srt, rtmp\\ss, hls, dash, etc protocols.
909
+ - false – stream is received by PUSH method. Use this when need to send stream
910
+ from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio.
911
+
912
+ quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to
913
+ your conditions. Look at GET /`quality_sets` method
914
+
915
+ record_type: Method of recording a stream. Specifies the source from which the stream will be
916
+ recorded: original or transcoded. Types:
917
+
918
+ - "origin" – To record RMTP/SRT/etc original clean media source.
919
+ - "transcoded" – To record the output transcoded version of the stream,
920
+ including overlays, texts, logos, etc. additional media layers.
921
+
922
+ uri: When using PULL method, this is the URL to pull a stream from. You can specify
923
+ multiple addresses separated by a space (" "), so you can organize a backup
924
+ plan. In this case, the specified addresses will be selected one by one using
925
+ round robin scheduling. If the first address does not respond, then the next one
926
+ in the list will be automatically requested, returning to the first and so on in
927
+ a circle. Also, if the sucessfully working stream stops sending data, then the
928
+ next one will be selected according to the same scheme. After 24 hours of
929
+ inactivity of your streams we will stop PULL-ing, and will switch "active" field
930
+ to "false". Please, note that this field is for PULL only, so is not suitable
931
+ for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method.
932
+
933
+ extra_headers: Send extra headers
934
+
935
+ extra_query: Add additional query parameters to the request
936
+
937
+ extra_body: Add additional JSON properties to the request
938
+
939
+ timeout: Override the client-level default timeout for this request, in seconds
940
+ """
941
+ return await self._post(
942
+ "/streaming/streams",
943
+ body=await async_maybe_transform(
944
+ {
945
+ "name": name,
946
+ "active": active,
947
+ "auto_record": auto_record,
948
+ "broadcast_ids": broadcast_ids,
949
+ "cdn_id": cdn_id,
950
+ "client_entity_data": client_entity_data,
951
+ "client_user_id": client_user_id,
952
+ "dvr_duration": dvr_duration,
953
+ "dvr_enabled": dvr_enabled,
954
+ "hls_mpegts_endlist_tag": hls_mpegts_endlist_tag,
955
+ "html_overlay": html_overlay,
956
+ "low_latency_enabled": low_latency_enabled,
957
+ "projection": projection,
958
+ "pull": pull,
959
+ "quality_set_id": quality_set_id,
960
+ "record_type": record_type,
961
+ "uri": uri,
962
+ },
963
+ stream_create_params.StreamCreateParams,
964
+ ),
965
+ options=make_request_options(
966
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
967
+ ),
968
+ cast_to=Stream,
969
+ )
970
+
971
+ async def update(
972
+ self,
973
+ stream_id: int,
974
+ *,
975
+ stream: stream_update_params.Stream | NotGiven = NOT_GIVEN,
976
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
977
+ # The extra values given here take precedence over values defined on the client or passed to this method.
978
+ extra_headers: Headers | None = None,
979
+ extra_query: Query | None = None,
980
+ extra_body: Body | None = None,
981
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
982
+ ) -> Stream:
983
+ """
984
+ Updates stream settings
985
+
986
+ Args:
987
+ extra_headers: Send extra headers
988
+
989
+ extra_query: Add additional query parameters to the request
990
+
991
+ extra_body: Add additional JSON properties to the request
992
+
993
+ timeout: Override the client-level default timeout for this request, in seconds
994
+ """
995
+ return await self._patch(
996
+ f"/streaming/streams/{stream_id}",
997
+ body=await async_maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams),
998
+ options=make_request_options(
999
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1000
+ ),
1001
+ cast_to=Stream,
1002
+ )
1003
+
1004
+ def list(
1005
+ self,
1006
+ *,
1007
+ page: int | NotGiven = NOT_GIVEN,
1008
+ with_broadcasts: int | NotGiven = NOT_GIVEN,
1009
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1010
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1011
+ extra_headers: Headers | None = None,
1012
+ extra_query: Query | None = None,
1013
+ extra_body: Body | None = None,
1014
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1015
+ ) -> AsyncPaginator[Stream, AsyncPageStreaming[Stream]]:
1016
+ """Returns a list of streams.
1017
+
1018
+ Args:
1019
+ page: Query parameter.
1020
+
1021
+ Use it to list the paginated content
1022
+
1023
+ with_broadcasts: Query parameter. Set to 1 to get details of the broadcasts associated with the
1024
+ stream
1025
+
1026
+ extra_headers: Send extra headers
1027
+
1028
+ extra_query: Add additional query parameters to the request
1029
+
1030
+ extra_body: Add additional JSON properties to the request
1031
+
1032
+ timeout: Override the client-level default timeout for this request, in seconds
1033
+ """
1034
+ return self._get_api_list(
1035
+ "/streaming/streams",
1036
+ page=AsyncPageStreaming[Stream],
1037
+ options=make_request_options(
1038
+ extra_headers=extra_headers,
1039
+ extra_query=extra_query,
1040
+ extra_body=extra_body,
1041
+ timeout=timeout,
1042
+ query=maybe_transform(
1043
+ {
1044
+ "page": page,
1045
+ "with_broadcasts": with_broadcasts,
1046
+ },
1047
+ stream_list_params.StreamListParams,
1048
+ ),
1049
+ ),
1050
+ model=Stream,
1051
+ )
1052
+
1053
+ async def delete(
1054
+ self,
1055
+ stream_id: int,
1056
+ *,
1057
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1058
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1059
+ extra_headers: Headers | None = None,
1060
+ extra_query: Query | None = None,
1061
+ extra_body: Body | None = None,
1062
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1063
+ ) -> None:
1064
+ """
1065
+ Delete a live stream.
1066
+
1067
+ After deleting the live stream, all associated data is deleted: settings, PUSH
1068
+ and PULL links, video playback links, etc. Live stream information is deleted
1069
+ permanently and irreversibly. Therefore, it is impossible to restore data and
1070
+ files after this. But if the live had recordings, they continue to remain
1071
+ independent Video entities. The "`stream_id`" parameter will simply point to a
1072
+ stream that no longer exists.
1073
+
1074
+ Perhaps, instead of deleting, you may use the stream deactivation:
1075
+
1076
+ ```
1077
+ PATCH /videos/{`stream_id`}
1078
+ { "active": false }
1079
+ ```
1080
+
1081
+ For details, see the Product Documentation.
1082
+
1083
+ Args:
1084
+ extra_headers: Send extra headers
1085
+
1086
+ extra_query: Add additional query parameters to the request
1087
+
1088
+ extra_body: Add additional JSON properties to the request
1089
+
1090
+ timeout: Override the client-level default timeout for this request, in seconds
1091
+ """
1092
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1093
+ return await self._delete(
1094
+ f"/streaming/streams/{stream_id}",
1095
+ options=make_request_options(
1096
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1097
+ ),
1098
+ cast_to=NoneType,
1099
+ )
1100
+
1101
+ async def clear_dvr(
1102
+ self,
1103
+ stream_id: int,
1104
+ *,
1105
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1106
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1107
+ extra_headers: Headers | None = None,
1108
+ extra_query: Query | None = None,
1109
+ extra_body: Body | None = None,
1110
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1111
+ ) -> None:
1112
+ """
1113
+ Clear live stream DVR
1114
+
1115
+ Args:
1116
+ extra_headers: Send extra headers
1117
+
1118
+ extra_query: Add additional query parameters to the request
1119
+
1120
+ extra_body: Add additional JSON properties to the request
1121
+
1122
+ timeout: Override the client-level default timeout for this request, in seconds
1123
+ """
1124
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1125
+ return await self._put(
1126
+ f"/streaming/streams/{stream_id}/dvr_cleanup",
1127
+ options=make_request_options(
1128
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1129
+ ),
1130
+ cast_to=NoneType,
1131
+ )
1132
+
1133
+ async def create_clip(
1134
+ self,
1135
+ stream_id: int,
1136
+ *,
1137
+ duration: int,
1138
+ expiration: int | NotGiven = NOT_GIVEN,
1139
+ start: int | NotGiven = NOT_GIVEN,
1140
+ vod_required: bool | NotGiven = NOT_GIVEN,
1141
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1142
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1143
+ extra_headers: Headers | None = None,
1144
+ extra_query: Query | None = None,
1145
+ extra_body: Body | None = None,
1146
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1147
+ ) -> Clip:
1148
+ """Create an instant clip from on-going live stream.
1149
+
1150
+ Instant clips are applicable
1151
+ in cases where there is no time to wait for the broadcast to be completed and
1152
+ recorded. For example, for quickly cutting highlights in sport events, or
1153
+ cutting an important moment in the news or live performance.
1154
+
1155
+ Instant clip becomes available for viewing in the following formats:
1156
+
1157
+ - HLS .m3u8,
1158
+ - MP4,
1159
+ - VOD in video hosting with a permanent link to watch video.
1160
+ ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`clip_recording_mp4_hls`.gif)
1161
+
1162
+ **Clip lifetime:** Instant clips are a copy of the stream, created from a live
1163
+ stream. They are stored in memory for a limited time, after which the clip
1164
+ ceases to exist and you will receive a 404 on the link. Limits that you should
1165
+ keep in mind:
1166
+
1167
+ - The clip's lifespan is controlled by `expiration` parameter.
1168
+ - The default expiration value is 1 hour. The value can be set from 1 minute to
1169
+ 4 hours.
1170
+ - If you want a video for longer or permanent viewing, then create a regular VOD
1171
+ based on the clip. This way you can use the clip's link for the first time,
1172
+ and immediately after the transcoded version is ready, you can change by
1173
+ yourself it to a permanent link of VOD.
1174
+ - The clip becomes available only after it is completely copied from the live
1175
+ stream. So the clip will be available after `start + duration` exact time. If
1176
+ you try to request it before this time, the response will be error code 425
1177
+ "Too Early".
1178
+
1179
+ **Cutting a clip from a source:** In order to use clips recording feature, DVR
1180
+ must be enabled for a stream: "`dvr_enabled`: true". The DVR serves as a source
1181
+ for creating clips:
1182
+
1183
+ - By default live stream DVR is set to 1 hour (3600 seconds). You can create an
1184
+ instant clip using any segment of this time period by specifying the desired
1185
+ start time and duration.
1186
+ - If you create a clip, but the DVR expires, the clip will still exist for the
1187
+ specified time as a copy of the stream.
1188
+
1189
+ **Getting permanent VOD:** To get permanent VOD version of a live clip use this
1190
+ parameter when making a request to create a clip: `vod_required: true`. Later,
1191
+ when the clip is ready, grab `video_id` value from the response and query the
1192
+ video by regular GET /video/{id} method.
1193
+
1194
+ Args:
1195
+ duration: Requested segment duration in seconds to be cut. Please, note that cutting is
1196
+ based on the idea of instantly creating a clip, instead of precise timing. So
1197
+ final segment may be:
1198
+
1199
+ - Less than the specified value if there is less data in the DVR than the
1200
+ requested segment.
1201
+ - Greater than the specified value, because segment is aligned to the first and
1202
+ last key frames of already stored fragment in DVR, this way -1 and +1 chunks
1203
+ can be added to left and right. Duration of cutted segment cannot be greater
1204
+ than DVR duration for this stream. Therefore, to change the maximum, use
1205
+ "`dvr_duration`" parameter of this stream.
1206
+
1207
+ expiration: Expire time of the clip via a public link. Unix timestamp in seconds, absolute
1208
+ value. This is the time how long the instant clip will be stored in the server
1209
+ memory and can be accessed via public HLS/MP4 links. Download and/or use the
1210
+ instant clip before this time expires. After the time has expired, the clip is
1211
+ deleted from memory and is no longer available via the link. You need to create
1212
+ a new segment, or use `vod_required: true` attribute. If value is omitted, then
1213
+ expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e.
1214
+ `unix timestamp = + + 3600`). Allowed range: 1m <= expiration <= 4h. Example:
1215
+ `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860`
1216
+
1217
+ start: Starting point of the segment to cut. Unix timestamp in seconds, absolute value.
1218
+ Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value
1219
+ from the past is specified, it is used as the starting point for the segment to
1220
+ cut. If the value is omitted, then clip will start from now.
1221
+
1222
+ vod_required: Indicates if video needs to be stored also as permanent VOD
1223
+
1224
+ extra_headers: Send extra headers
1225
+
1226
+ extra_query: Add additional query parameters to the request
1227
+
1228
+ extra_body: Add additional JSON properties to the request
1229
+
1230
+ timeout: Override the client-level default timeout for this request, in seconds
1231
+ """
1232
+ return await self._put(
1233
+ f"/streaming/streams/{stream_id}/clip_recording",
1234
+ body=await async_maybe_transform(
1235
+ {
1236
+ "duration": duration,
1237
+ "expiration": expiration,
1238
+ "start": start,
1239
+ "vod_required": vod_required,
1240
+ },
1241
+ stream_create_clip_params.StreamCreateClipParams,
1242
+ ),
1243
+ options=make_request_options(
1244
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1245
+ ),
1246
+ cast_to=Clip,
1247
+ )
1248
+
1249
+ async def get(
1250
+ self,
1251
+ stream_id: int,
1252
+ *,
1253
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1254
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1255
+ extra_headers: Headers | None = None,
1256
+ extra_query: Query | None = None,
1257
+ extra_body: Body | None = None,
1258
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1259
+ ) -> Stream:
1260
+ """
1261
+ Returns stream details
1262
+
1263
+ Args:
1264
+ extra_headers: Send extra headers
1265
+
1266
+ extra_query: Add additional query parameters to the request
1267
+
1268
+ extra_body: Add additional JSON properties to the request
1269
+
1270
+ timeout: Override the client-level default timeout for this request, in seconds
1271
+ """
1272
+ return await self._get(
1273
+ f"/streaming/streams/{stream_id}",
1274
+ options=make_request_options(
1275
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1276
+ ),
1277
+ cast_to=Stream,
1278
+ )
1279
+
1280
+ async def list_clips(
1281
+ self,
1282
+ stream_id: int,
1283
+ *,
1284
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1285
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1286
+ extra_headers: Headers | None = None,
1287
+ extra_query: Query | None = None,
1288
+ extra_body: Body | None = None,
1289
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1290
+ ) -> StreamListClipsResponse:
1291
+ """
1292
+ Get list of non expired instant clips for a stream.
1293
+
1294
+ You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs
1295
+ from "`hls_master`" and "`mp4_master`".
1296
+
1297
+ **How to download renditions of clips:** URLs contain "master" alias by default,
1298
+ which means maximum available quality from ABR set (based on height metadata).
1299
+ There is also possibility to access individual bitrates from ABR ladder. That
1300
+ works for both HLS and MP4. You can replace manually "master" to a value from
1301
+ renditions list in order to get exact bitrate/quality from the set. Example:
1302
+
1303
+ - HLS 720p:
1304
+ `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.m3u8 ``
1305
+ - HLS 720p:
1306
+ `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.m3u8 ``
1307
+ - MP4 360p:
1308
+ `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.mp4 ``
1309
+ - MP4 360p:
1310
+ `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.mp4 ``
1311
+
1312
+ Args:
1313
+ extra_headers: Send extra headers
1314
+
1315
+ extra_query: Add additional query parameters to the request
1316
+
1317
+ extra_body: Add additional JSON properties to the request
1318
+
1319
+ timeout: Override the client-level default timeout for this request, in seconds
1320
+ """
1321
+ return await self._get(
1322
+ f"/streaming/streams/{stream_id}/clip_recording",
1323
+ options=make_request_options(
1324
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1325
+ ),
1326
+ cast_to=StreamListClipsResponse,
1327
+ )
1328
+
1329
+ async def start_recording(
1330
+ self,
1331
+ stream_id: int,
1332
+ *,
1333
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1334
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1335
+ extra_headers: Headers | None = None,
1336
+ extra_query: Query | None = None,
1337
+ extra_body: Body | None = None,
1338
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1339
+ ) -> StreamStartRecordingResponse:
1340
+ """
1341
+ Start recording a stream.
1342
+
1343
+ Stream will be recorded and automatically saved in our video hosting as a
1344
+ separate video VOD:
1345
+
1346
+ - ID of the stream from which the recording was organized is added to
1347
+ "`stream_id`" field. You can find the video by that value later.
1348
+ - Title of the video is based on pattern "Stream Record: {`stream_title`},
1349
+ {`recording_end_time_utc`}".
1350
+ - Recording start time is stored in "`recording_started_at`" field.
1351
+ - You can record the original stream or the transcoded one. Only the transcoded
1352
+ version will contain overlays. Set the appropriate recording method when
1353
+ creating the stream or before calling this recording method. Details in the
1354
+ "`record_type`" parameter of the stream.
1355
+ - If you have access to the premium feature of saving the original stream (so
1356
+ not just transcoded renditions), then the link to the original file will be in
1357
+ the "`origin_url`" field. Look at the description of the field how to use it.
1358
+ Stream must be live for the recording to start, please check fields "live"
1359
+ and/or "`backup_live`". After the recording starts, field "recording" will
1360
+ switch to "true", and the recording duration in seconds will appear in the
1361
+ "`recording_duration`" field. Please, keep in mind that recording doesn't
1362
+ start instantly, it takes ±3-7 seconds to initialize the process after
1363
+ executing this method.
1364
+
1365
+ Stream recording stops when:
1366
+
1367
+ - Explicit execution of the method /`stop_recording`. In this case, the file
1368
+ will be completely saved and closed. When you execute the stream recording
1369
+ method again, the recording will be made to a new video file.
1370
+ - When sending the stream stops on the client side, or stops accidentally. In
1371
+ this case, recording process is waiting for 10 seconds to resume recording:
1372
+ - If the stream resumes within that period, recording will continue to the same
1373
+ file.
1374
+ - After that period, the file will be completely saved and closed.
1375
+ - If the stream suddenly resumes after this period, the recording will go to a
1376
+ new file, because old file is closed already. Please, also note that if you
1377
+ have long broadcasts, the recording will be cut into 4-hour videos. This value
1378
+ is fixed, but can be changed upon request to the Support Team.
1379
+
1380
+ Args:
1381
+ extra_headers: Send extra headers
1382
+
1383
+ extra_query: Add additional query parameters to the request
1384
+
1385
+ extra_body: Add additional JSON properties to the request
1386
+
1387
+ timeout: Override the client-level default timeout for this request, in seconds
1388
+ """
1389
+ return await self._put(
1390
+ f"/streaming/streams/{stream_id}/start_recording",
1391
+ options=make_request_options(
1392
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1393
+ ),
1394
+ cast_to=StreamStartRecordingResponse,
1395
+ )
1396
+
1397
+ async def stop_recording(
1398
+ self,
1399
+ stream_id: int,
1400
+ *,
1401
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1402
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1403
+ extra_headers: Headers | None = None,
1404
+ extra_query: Query | None = None,
1405
+ extra_body: Body | None = None,
1406
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1407
+ ) -> Video:
1408
+ """
1409
+ Stop recording a stream.
1410
+
1411
+ Stream must be in "recording: true" state for recording to be stopped.
1412
+
1413
+ If there was a recording, the created video entity will be returned. Otherwise
1414
+ the response will be empty. Please see conditions and restrictions for recording
1415
+ a stream in the description of method /`start_recording`.
1416
+
1417
+ Args:
1418
+ extra_headers: Send extra headers
1419
+
1420
+ extra_query: Add additional query parameters to the request
1421
+
1422
+ extra_body: Add additional JSON properties to the request
1423
+
1424
+ timeout: Override the client-level default timeout for this request, in seconds
1425
+ """
1426
+ return await self._put(
1427
+ f"/streaming/streams/{stream_id}/stop_recording",
1428
+ options=make_request_options(
1429
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1430
+ ),
1431
+ cast_to=Video,
1432
+ )
1433
+
1434
+
1435
+ class StreamsResourceWithRawResponse:
1436
+ def __init__(self, streams: StreamsResource) -> None:
1437
+ self._streams = streams
1438
+
1439
+ self.create = to_raw_response_wrapper(
1440
+ streams.create,
1441
+ )
1442
+ self.update = to_raw_response_wrapper(
1443
+ streams.update,
1444
+ )
1445
+ self.list = to_raw_response_wrapper(
1446
+ streams.list,
1447
+ )
1448
+ self.delete = to_raw_response_wrapper(
1449
+ streams.delete,
1450
+ )
1451
+ self.clear_dvr = to_raw_response_wrapper(
1452
+ streams.clear_dvr,
1453
+ )
1454
+ self.create_clip = to_raw_response_wrapper(
1455
+ streams.create_clip,
1456
+ )
1457
+ self.get = to_raw_response_wrapper(
1458
+ streams.get,
1459
+ )
1460
+ self.list_clips = to_raw_response_wrapper(
1461
+ streams.list_clips,
1462
+ )
1463
+ self.start_recording = to_raw_response_wrapper(
1464
+ streams.start_recording,
1465
+ )
1466
+ self.stop_recording = to_raw_response_wrapper(
1467
+ streams.stop_recording,
1468
+ )
1469
+
1470
+ @cached_property
1471
+ def overlays(self) -> OverlaysResourceWithRawResponse:
1472
+ return OverlaysResourceWithRawResponse(self._streams.overlays)
1473
+
1474
+
1475
+ class AsyncStreamsResourceWithRawResponse:
1476
+ def __init__(self, streams: AsyncStreamsResource) -> None:
1477
+ self._streams = streams
1478
+
1479
+ self.create = async_to_raw_response_wrapper(
1480
+ streams.create,
1481
+ )
1482
+ self.update = async_to_raw_response_wrapper(
1483
+ streams.update,
1484
+ )
1485
+ self.list = async_to_raw_response_wrapper(
1486
+ streams.list,
1487
+ )
1488
+ self.delete = async_to_raw_response_wrapper(
1489
+ streams.delete,
1490
+ )
1491
+ self.clear_dvr = async_to_raw_response_wrapper(
1492
+ streams.clear_dvr,
1493
+ )
1494
+ self.create_clip = async_to_raw_response_wrapper(
1495
+ streams.create_clip,
1496
+ )
1497
+ self.get = async_to_raw_response_wrapper(
1498
+ streams.get,
1499
+ )
1500
+ self.list_clips = async_to_raw_response_wrapper(
1501
+ streams.list_clips,
1502
+ )
1503
+ self.start_recording = async_to_raw_response_wrapper(
1504
+ streams.start_recording,
1505
+ )
1506
+ self.stop_recording = async_to_raw_response_wrapper(
1507
+ streams.stop_recording,
1508
+ )
1509
+
1510
+ @cached_property
1511
+ def overlays(self) -> AsyncOverlaysResourceWithRawResponse:
1512
+ return AsyncOverlaysResourceWithRawResponse(self._streams.overlays)
1513
+
1514
+
1515
+ class StreamsResourceWithStreamingResponse:
1516
+ def __init__(self, streams: StreamsResource) -> None:
1517
+ self._streams = streams
1518
+
1519
+ self.create = to_streamed_response_wrapper(
1520
+ streams.create,
1521
+ )
1522
+ self.update = to_streamed_response_wrapper(
1523
+ streams.update,
1524
+ )
1525
+ self.list = to_streamed_response_wrapper(
1526
+ streams.list,
1527
+ )
1528
+ self.delete = to_streamed_response_wrapper(
1529
+ streams.delete,
1530
+ )
1531
+ self.clear_dvr = to_streamed_response_wrapper(
1532
+ streams.clear_dvr,
1533
+ )
1534
+ self.create_clip = to_streamed_response_wrapper(
1535
+ streams.create_clip,
1536
+ )
1537
+ self.get = to_streamed_response_wrapper(
1538
+ streams.get,
1539
+ )
1540
+ self.list_clips = to_streamed_response_wrapper(
1541
+ streams.list_clips,
1542
+ )
1543
+ self.start_recording = to_streamed_response_wrapper(
1544
+ streams.start_recording,
1545
+ )
1546
+ self.stop_recording = to_streamed_response_wrapper(
1547
+ streams.stop_recording,
1548
+ )
1549
+
1550
+ @cached_property
1551
+ def overlays(self) -> OverlaysResourceWithStreamingResponse:
1552
+ return OverlaysResourceWithStreamingResponse(self._streams.overlays)
1553
+
1554
+
1555
+ class AsyncStreamsResourceWithStreamingResponse:
1556
+ def __init__(self, streams: AsyncStreamsResource) -> None:
1557
+ self._streams = streams
1558
+
1559
+ self.create = async_to_streamed_response_wrapper(
1560
+ streams.create,
1561
+ )
1562
+ self.update = async_to_streamed_response_wrapper(
1563
+ streams.update,
1564
+ )
1565
+ self.list = async_to_streamed_response_wrapper(
1566
+ streams.list,
1567
+ )
1568
+ self.delete = async_to_streamed_response_wrapper(
1569
+ streams.delete,
1570
+ )
1571
+ self.clear_dvr = async_to_streamed_response_wrapper(
1572
+ streams.clear_dvr,
1573
+ )
1574
+ self.create_clip = async_to_streamed_response_wrapper(
1575
+ streams.create_clip,
1576
+ )
1577
+ self.get = async_to_streamed_response_wrapper(
1578
+ streams.get,
1579
+ )
1580
+ self.list_clips = async_to_streamed_response_wrapper(
1581
+ streams.list_clips,
1582
+ )
1583
+ self.start_recording = async_to_streamed_response_wrapper(
1584
+ streams.start_recording,
1585
+ )
1586
+ self.stop_recording = async_to_streamed_response_wrapper(
1587
+ streams.stop_recording,
1588
+ )
1589
+
1590
+ @cached_property
1591
+ def overlays(self) -> AsyncOverlaysResourceWithStreamingResponse:
1592
+ return AsyncOverlaysResourceWithStreamingResponse(self._streams.overlays)