gcore 0.5.0__py3-none-any.whl → 0.7.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 (200) 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 -1
  5. gcore/resources/__init__.py +14 -0
  6. gcore/resources/cloud/__init__.py +42 -0
  7. gcore/resources/cloud/audit_logs.py +480 -0
  8. gcore/resources/cloud/cloud.py +96 -0
  9. gcore/resources/cloud/cost_reports.py +811 -0
  10. gcore/resources/cloud/file_shares/file_shares.py +74 -9
  11. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +61 -26
  12. gcore/resources/cloud/inference/__init__.py +14 -0
  13. gcore/resources/cloud/inference/api_keys.py +621 -0
  14. gcore/resources/cloud/inference/inference.py +32 -0
  15. gcore/resources/cloud/inference/registry_credentials.py +4 -6
  16. gcore/resources/cloud/load_balancers/pools/members.py +22 -6
  17. gcore/resources/cloud/usage_reports.py +337 -0
  18. gcore/resources/streaming/__init__.py +159 -0
  19. gcore/resources/streaming/ai_tasks.py +1288 -0
  20. gcore/resources/streaming/broadcasts.py +579 -0
  21. gcore/resources/streaming/directories.py +515 -0
  22. gcore/resources/streaming/players.py +577 -0
  23. gcore/resources/streaming/playlists.py +1059 -0
  24. gcore/resources/streaming/quality_sets.py +331 -0
  25. gcore/resources/streaming/restreams.py +484 -0
  26. gcore/resources/streaming/statistics.py +3224 -0
  27. gcore/resources/streaming/streaming.py +390 -0
  28. gcore/resources/streaming/streams/__init__.py +33 -0
  29. gcore/resources/streaming/streams/overlays.py +716 -0
  30. gcore/resources/streaming/streams/streams.py +1592 -0
  31. gcore/resources/streaming/videos/__init__.py +33 -0
  32. gcore/resources/streaming/videos/subtitles.py +623 -0
  33. gcore/resources/streaming/videos/videos.py +1553 -0
  34. gcore/resources/waap/ip_info.py +28 -10
  35. gcore/types/cloud/__init__.py +12 -0
  36. gcore/types/cloud/audit_log_entry.py +254 -0
  37. gcore/types/cloud/audit_log_list_params.py +158 -0
  38. gcore/types/cloud/cost_report_aggregated.py +865 -0
  39. gcore/types/cloud/cost_report_aggregated_monthly.py +865 -0
  40. gcore/types/cloud/cost_report_detailed.py +1343 -0
  41. gcore/types/cloud/cost_report_get_aggregated_monthly_params.py +394 -0
  42. gcore/types/cloud/cost_report_get_aggregated_params.py +409 -0
  43. gcore/types/cloud/cost_report_get_detailed_params.py +435 -0
  44. gcore/types/cloud/file_share.py +37 -3
  45. gcore/types/cloud/file_share_create_params.py +16 -0
  46. gcore/types/cloud/file_share_update_params.py +29 -3
  47. gcore/types/cloud/gpu_baremetal_cluster.py +2 -2
  48. gcore/types/cloud/gpu_baremetal_cluster_create_params.py +9 -0
  49. gcore/types/cloud/inference/__init__.py +5 -0
  50. gcore/types/cloud/inference/api_key_create_params.py +21 -0
  51. gcore/types/cloud/inference/api_key_list_params.py +21 -0
  52. gcore/types/cloud/inference/api_key_update_params.py +16 -0
  53. gcore/types/cloud/inference/inference_api_key.py +24 -0
  54. gcore/types/cloud/inference/inference_api_key_create.py +27 -0
  55. gcore/types/cloud/load_balancer_create_params.py +14 -3
  56. gcore/types/cloud/load_balancers/pool_create_params.py +14 -3
  57. gcore/types/cloud/load_balancers/pool_update_params.py +14 -3
  58. gcore/types/cloud/load_balancers/pools/member_add_params.py +14 -3
  59. gcore/types/cloud/member.py +12 -4
  60. gcore/types/cloud/quota_get_all_response.py +24 -2
  61. gcore/types/cloud/quota_get_by_region_response.py +24 -2
  62. gcore/types/cloud/quotas/request_create_params.py +12 -1
  63. gcore/types/cloud/quotas/request_get_response.py +12 -1
  64. gcore/types/cloud/quotas/request_list_response.py +12 -1
  65. gcore/types/cloud/usage_report.py +1612 -0
  66. gcore/types/cloud/usage_report_get_params.py +432 -0
  67. gcore/types/streaming/__init__.py +143 -0
  68. gcore/types/streaming/ai_contentmoderation_casm.py +39 -0
  69. gcore/types/streaming/ai_contentmoderation_hardnudity.py +54 -0
  70. gcore/types/streaming/ai_contentmoderation_nsfw.py +39 -0
  71. gcore/types/streaming/ai_contentmoderation_softnudity.py +66 -0
  72. gcore/types/streaming/ai_contentmoderation_sport.py +39 -0
  73. gcore/types/streaming/ai_contentmoderation_weapon.py +39 -0
  74. gcore/types/streaming/ai_task.py +205 -0
  75. gcore/types/streaming/ai_task_cancel_response.py +12 -0
  76. gcore/types/streaming/ai_task_create_params.py +168 -0
  77. gcore/types/streaming/ai_task_create_response.py +10 -0
  78. gcore/types/streaming/ai_task_get_ai_settings_params.py +27 -0
  79. gcore/types/streaming/ai_task_get_ai_settings_response.py +12 -0
  80. gcore/types/streaming/ai_task_get_response.py +313 -0
  81. gcore/types/streaming/ai_task_list_params.py +50 -0
  82. gcore/types/streaming/broadcast.py +71 -0
  83. gcore/types/streaming/broadcast_create_params.py +76 -0
  84. gcore/types/streaming/broadcast_list_params.py +12 -0
  85. gcore/types/streaming/broadcast_spectators_count.py +12 -0
  86. gcore/types/streaming/broadcast_update_params.py +76 -0
  87. gcore/types/streaming/clip.py +78 -0
  88. gcore/types/streaming/create_video_param.py +214 -0
  89. gcore/types/streaming/direct_upload_parameters.py +33 -0
  90. gcore/types/streaming/directories_tree.py +19 -0
  91. gcore/types/streaming/directory_base.py +31 -0
  92. gcore/types/streaming/directory_create_params.py +15 -0
  93. gcore/types/streaming/directory_get_response.py +19 -0
  94. gcore/types/streaming/directory_item.py +13 -0
  95. gcore/types/streaming/directory_update_params.py +18 -0
  96. gcore/types/streaming/directory_video.py +13 -0
  97. gcore/types/streaming/ffprobes.py +25 -0
  98. gcore/types/streaming/max_stream_series.py +21 -0
  99. gcore/types/streaming/meet_series.py +23 -0
  100. gcore/types/streaming/player.py +114 -0
  101. gcore/types/streaming/player_create_params.py +18 -0
  102. gcore/types/streaming/player_list_params.py +12 -0
  103. gcore/types/streaming/player_param.py +114 -0
  104. gcore/types/streaming/player_update_params.py +18 -0
  105. gcore/types/streaming/playlist.py +102 -0
  106. gcore/types/streaming/playlist_create.py +12 -0
  107. gcore/types/streaming/playlist_create_params.py +102 -0
  108. gcore/types/streaming/playlist_list_params.py +12 -0
  109. gcore/types/streaming/playlist_list_videos_response.py +10 -0
  110. gcore/types/streaming/playlist_update_params.py +102 -0
  111. gcore/types/streaming/playlist_video.py +215 -0
  112. gcore/types/streaming/popular_videos.py +17 -0
  113. gcore/types/streaming/quality_set_set_default_params.py +23 -0
  114. gcore/types/streaming/quality_sets.py +57 -0
  115. gcore/types/streaming/restream.py +37 -0
  116. gcore/types/streaming/restream_create_params.py +41 -0
  117. gcore/types/streaming/restream_list_params.py +12 -0
  118. gcore/types/streaming/restream_update_params.py +41 -0
  119. gcore/types/streaming/statistic_get_ffprobes_params.py +22 -0
  120. gcore/types/streaming/statistic_get_live_unique_viewers_params.py +26 -0
  121. gcore/types/streaming/statistic_get_live_unique_viewers_response.py +25 -0
  122. gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py +32 -0
  123. gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py +30 -0
  124. gcore/types/streaming/statistic_get_max_streams_series_params.py +20 -0
  125. gcore/types/streaming/statistic_get_meet_series_params.py +20 -0
  126. gcore/types/streaming/statistic_get_popular_videos_params.py +15 -0
  127. gcore/types/streaming/statistic_get_storage_series_params.py +20 -0
  128. gcore/types/streaming/statistic_get_stream_series_params.py +20 -0
  129. gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py +27 -0
  130. gcore/types/streaming/statistic_get_unique_viewers_params.py +34 -0
  131. gcore/types/streaming/statistic_get_views_by_browsers_params.py +15 -0
  132. gcore/types/streaming/statistic_get_views_by_country_params.py +15 -0
  133. gcore/types/streaming/statistic_get_views_by_hostname_params.py +15 -0
  134. gcore/types/streaming/statistic_get_views_by_operating_system_params.py +15 -0
  135. gcore/types/streaming/statistic_get_views_by_referer_params.py +15 -0
  136. gcore/types/streaming/statistic_get_views_by_region_params.py +15 -0
  137. gcore/types/streaming/statistic_get_views_heatmap_params.py +21 -0
  138. gcore/types/streaming/statistic_get_views_params.py +34 -0
  139. gcore/types/streaming/statistic_get_vod_storage_volume_params.py +17 -0
  140. gcore/types/streaming/statistic_get_vod_transcoding_duration_params.py +17 -0
  141. gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py +26 -0
  142. gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py +32 -0
  143. gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py +30 -0
  144. gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py +22 -0
  145. gcore/types/streaming/storage_series.py +23 -0
  146. gcore/types/streaming/stream.py +420 -0
  147. gcore/types/streaming/stream_create_clip_params.py +48 -0
  148. gcore/types/streaming/stream_create_params.py +165 -0
  149. gcore/types/streaming/stream_list_clips_response.py +10 -0
  150. gcore/types/streaming/stream_list_params.py +18 -0
  151. gcore/types/streaming/stream_series.py +21 -0
  152. gcore/types/streaming/stream_start_recording_response.py +76 -0
  153. gcore/types/streaming/stream_update_params.py +169 -0
  154. gcore/types/streaming/streams/__init__.py +11 -0
  155. gcore/types/streaming/streams/overlay.py +43 -0
  156. gcore/types/streaming/streams/overlay_create_params.py +36 -0
  157. gcore/types/streaming/streams/overlay_create_response.py +10 -0
  158. gcore/types/streaming/streams/overlay_list_response.py +10 -0
  159. gcore/types/streaming/streams/overlay_update_multiple_params.py +39 -0
  160. gcore/types/streaming/streams/overlay_update_multiple_response.py +10 -0
  161. gcore/types/streaming/streams/overlay_update_params.py +33 -0
  162. gcore/types/streaming/subtitle.py +12 -0
  163. gcore/types/streaming/subtitle_base.py +18 -0
  164. gcore/types/streaming/subtitle_base_param.py +18 -0
  165. gcore/types/streaming/unique_viewers.py +35 -0
  166. gcore/types/streaming/unique_viewers_cdn.py +17 -0
  167. gcore/types/streaming/video.py +444 -0
  168. gcore/types/streaming/video_create_multiple_params.py +28 -0
  169. gcore/types/streaming/video_create_multiple_response.py +10 -0
  170. gcore/types/streaming/video_create_params.py +13 -0
  171. gcore/types/streaming/video_create_response.py +10 -0
  172. gcore/types/streaming/video_list_names_params.py +13 -0
  173. gcore/types/streaming/video_list_params.py +59 -0
  174. gcore/types/streaming/video_update_params.py +214 -0
  175. gcore/types/streaming/videos/__init__.py +7 -0
  176. gcore/types/streaming/videos/subtitle_create_params.py +17 -0
  177. gcore/types/streaming/videos/subtitle_list_response.py +10 -0
  178. gcore/types/streaming/videos/subtitle_update_params.py +20 -0
  179. gcore/types/streaming/views.py +35 -0
  180. gcore/types/streaming/views_by_browser.py +17 -0
  181. gcore/types/streaming/views_by_country.py +19 -0
  182. gcore/types/streaming/views_by_hostname.py +17 -0
  183. gcore/types/streaming/views_by_operating_system.py +17 -0
  184. gcore/types/streaming/views_by_referer.py +17 -0
  185. gcore/types/streaming/views_by_region.py +19 -0
  186. gcore/types/streaming/views_heatmap.py +19 -0
  187. gcore/types/streaming/vod_statistics_series.py +21 -0
  188. gcore/types/streaming/vod_total_stream_duration_series.py +22 -0
  189. gcore/types/waap/domains/custom_rule_create_params.py +4 -4
  190. gcore/types/waap/domains/custom_rule_update_params.py +4 -4
  191. gcore/types/waap/ip_info_get_blocked_requests_params.py +5 -1
  192. gcore/types/waap/ip_info_get_counts_params.py +2 -1
  193. gcore/types/waap/ip_info_get_top_sessions_params.py +5 -1
  194. gcore/types/waap/ip_info_get_top_urls_params.py +5 -1
  195. gcore/types/waap/ip_info_get_top_user_agents_params.py +5 -1
  196. gcore/types/waap/waap_custom_rule.py +4 -4
  197. {gcore-0.5.0.dist-info → gcore-0.7.0.dist-info}/METADATA +2 -3
  198. {gcore-0.5.0.dist-info → gcore-0.7.0.dist-info}/RECORD +200 -43
  199. {gcore-0.5.0.dist-info → gcore-0.7.0.dist-info}/WHEEL +0 -0
  200. {gcore-0.5.0.dist-info → gcore-0.7.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,1553 @@
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 ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
11
+ from ...._utils import maybe_transform, async_maybe_transform
12
+ from .subtitles import (
13
+ SubtitlesResource,
14
+ AsyncSubtitlesResource,
15
+ SubtitlesResourceWithRawResponse,
16
+ AsyncSubtitlesResourceWithRawResponse,
17
+ SubtitlesResourceWithStreamingResponse,
18
+ AsyncSubtitlesResourceWithStreamingResponse,
19
+ )
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
+ video_list_params,
32
+ video_create_params,
33
+ video_update_params,
34
+ video_list_names_params,
35
+ video_create_multiple_params,
36
+ )
37
+ from ....types.streaming.video import Video
38
+ from ....types.streaming.create_video_param import CreateVideoParam
39
+ from ....types.streaming.video_create_response import VideoCreateResponse
40
+ from ....types.streaming.direct_upload_parameters import DirectUploadParameters
41
+ from ....types.streaming.video_create_multiple_response import VideoCreateMultipleResponse
42
+
43
+ __all__ = ["VideosResource", "AsyncVideosResource"]
44
+
45
+
46
+ class VideosResource(SyncAPIResource):
47
+ @cached_property
48
+ def subtitles(self) -> SubtitlesResource:
49
+ return SubtitlesResource(self._client)
50
+
51
+ @cached_property
52
+ def with_raw_response(self) -> VideosResourceWithRawResponse:
53
+ """
54
+ This property can be used as a prefix for any HTTP method call to return
55
+ the raw response object instead of the parsed content.
56
+
57
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
58
+ """
59
+ return VideosResourceWithRawResponse(self)
60
+
61
+ @cached_property
62
+ def with_streaming_response(self) -> VideosResourceWithStreamingResponse:
63
+ """
64
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
65
+
66
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
67
+ """
68
+ return VideosResourceWithStreamingResponse(self)
69
+
70
+ def create(
71
+ self,
72
+ *,
73
+ video: CreateVideoParam | NotGiven = NOT_GIVEN,
74
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
75
+ # The extra values given here take precedence over values defined on the client or passed to this method.
76
+ extra_headers: Headers | None = None,
77
+ extra_query: Query | None = None,
78
+ extra_body: Body | None = None,
79
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
80
+ ) -> VideoCreateResponse:
81
+ """
82
+ Use this method to create a new video entity.
83
+
84
+ **Methods of creating** To upload the original video file to the server, there
85
+ are several possible scenarios:
86
+
87
+ - **Copy from another server** – If your video is accessable via "http://",
88
+ "https://", or "sftp://" public link, then you can use this method to copy a
89
+ file from an external server. Set `origin_url` parameter with the link to the
90
+ original video file (i.e. "https://domain.com/video.mp4"). After method
91
+ execution file will be uploaded and will be sent to transcoding automatically,
92
+ you don't have to do anything else. Use extra field `origin_http_headers` if
93
+ authorization is required on the external server.
94
+ - **Direct upload from a local device** – If you need to upload video directly
95
+ from your local device or from a mobile app, then use this method. Keep
96
+ `origin_url` empty and use TUS protocol ([tus.io](https://tus.io)) to upload
97
+ file. More details are here
98
+ ["Get TUS' upload"](/docs/api-reference/streaming/videos/get-tus-parameters-for-direct-upload)
99
+ After getting the video, it is processed through the queue. There are 2
100
+ priority criteria: global and local. Global is determined automatically by the
101
+ system as converters are ready to get next video, so your videos rarely queue
102
+ longer than usual (when you don't have a dedicated region). Local priority
103
+ works at the level of your account and you have full control over it, look at
104
+ "priority" attribute.
105
+
106
+ **AI processing** When uploading a video, it is possible to automatically create
107
+ subtitles based on AI. Read more:
108
+
109
+ - What is
110
+ ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task).
111
+ - If the option is enabled via `auto_transcribe_audio_language: auto|`, then
112
+ immediately after successful transcoding, an AI task will be automatically
113
+ created for transcription.
114
+ - If you need to translate subtitles from original language to any other, then
115
+ AI-task of subtitles translation can be applied. Use
116
+ `auto_translate_subtitles_language: default|` parameter for that. Also you can
117
+ point several languages to translate to, then a separate subtitle will be
118
+ generated for each specified language.
119
+ - How to
120
+ ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle).
121
+ The created AI-task(s) will be automatically executed, and result will also be
122
+ automatically attached to this video as subtitle(s). Please note that
123
+ transcription is done automatically for all videos uploaded to our video
124
+ hosting. If necessary, you can disable automatic creation of subtitles. If AI
125
+ is disabled in your account, no AI functionality is called.
126
+
127
+ **Advanced Features** For details on the requirements for incoming original
128
+ files, and output video parameters after transcoding, refer to the Knowledge
129
+ Base documentation. By default video will be transcoded according to the
130
+ original resolution, and a quality ladder suitable for your original video will
131
+ be applied. There is no automatic upscaling; the maximum quality is taken from
132
+ the original video. If you want to upload specific files not explicitly listed
133
+ in requirements or wish to modify the standard quality ladder (i.e. decrease
134
+ quality or add new non-standard qualities), then such customization is possible.
135
+ Please reach out to us for assistance.
136
+
137
+ Additionally, check the Knowledge Base for any supplementary information you may
138
+ need.
139
+
140
+ Args:
141
+ extra_headers: Send extra headers
142
+
143
+ extra_query: Add additional query parameters to the request
144
+
145
+ extra_body: Add additional JSON properties to the request
146
+
147
+ timeout: Override the client-level default timeout for this request, in seconds
148
+ """
149
+ return self._post(
150
+ "/streaming/videos",
151
+ body=maybe_transform({"video": video}, video_create_params.VideoCreateParams),
152
+ options=make_request_options(
153
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
154
+ ),
155
+ cast_to=VideoCreateResponse,
156
+ )
157
+
158
+ def update(
159
+ self,
160
+ video_id: int,
161
+ *,
162
+ name: str,
163
+ auto_transcribe_audio_language: Literal["disable", "auto", "<language_code>"] | NotGiven = NOT_GIVEN,
164
+ auto_translate_subtitles_language: Literal["disable", "default", "<language_codes,>"] | NotGiven = NOT_GIVEN,
165
+ client_user_id: int | NotGiven = NOT_GIVEN,
166
+ clip_duration_seconds: int | NotGiven = NOT_GIVEN,
167
+ clip_start_seconds: int | NotGiven = NOT_GIVEN,
168
+ custom_iframe_url: str | NotGiven = NOT_GIVEN,
169
+ description: str | NotGiven = NOT_GIVEN,
170
+ directory_id: int | NotGiven = NOT_GIVEN,
171
+ origin_http_headers: str | NotGiven = NOT_GIVEN,
172
+ origin_url: str | NotGiven = NOT_GIVEN,
173
+ poster: str | NotGiven = NOT_GIVEN,
174
+ priority: int | NotGiven = NOT_GIVEN,
175
+ projection: str | NotGiven = NOT_GIVEN,
176
+ quality_set_id: int | NotGiven = NOT_GIVEN,
177
+ remote_poster_url: str | NotGiven = NOT_GIVEN,
178
+ remove_poster: bool | NotGiven = NOT_GIVEN,
179
+ screenshot_id: int | NotGiven = NOT_GIVEN,
180
+ share_url: str | NotGiven = NOT_GIVEN,
181
+ source_bitrate_limit: bool | NotGiven = NOT_GIVEN,
182
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
183
+ # The extra values given here take precedence over values defined on the client or passed to this method.
184
+ extra_headers: Headers | None = None,
185
+ extra_query: Query | None = None,
186
+ extra_body: Body | None = None,
187
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
188
+ ) -> Video:
189
+ """Changes parameters of the video to new values.
190
+
191
+ It's allowed to update only those
192
+ public parameters that are described in POST method to create a new “video”
193
+ entity. So it's not possible to change calculated parameters like "id",
194
+ "duration", "`hls_url`", etc. Examples of changing:
195
+
196
+ - Name: `{ "name": "new name of the video" }`
197
+ - Move the video to a new directory: `` { "`directory_id`": 200 }`` Please note
198
+ that some parameters are used on initial step (before transcoding) only, so
199
+ after transcoding there is no use in changing their values. For example,
200
+ "`origin_url`" parameter is used for downloading an original file from a
201
+ source and never used after transcoding; or "priority" parameter is used to
202
+ set priority of processing and never used after transcoding.
203
+
204
+ Args:
205
+ name: Video name
206
+
207
+ auto_transcribe_audio_language:
208
+ Automatic creation of subtitles by transcribing the audio track. Values:
209
+
210
+ - disable – Do not transcribe.
211
+ - auto – Automatically detects the activation of the option based on the
212
+ settings in your account. If generation is activated, then automatic language
213
+ detection while transcribing.
214
+ - \\ – Transcribe from specific language. Can be used to specify the exact
215
+ language spoken in the audio track, or when auto language detection fails.
216
+ Language is set by 3-letter language code according to ISO-639-2
217
+ (bibliographic code). List of languages is available in `audio_language`
218
+ attribute of API POST /streaming/ai/transcribe . Example:
219
+
220
+ ```
221
+ `auto_transcribe_audio_language`: "auto"
222
+ `auto_transcribe_audio_language`: "ger"
223
+ ```
224
+
225
+ More details:
226
+
227
+ - List of AI tasks – API
228
+ [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result)
229
+ - Add subtitles to an exist video – API
230
+ [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle).
231
+
232
+ auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified
233
+ language(s). Can be used both together with `auto_transcribe_audio_language`
234
+ option only. Use it when you want to make automatic subtitles in languages other
235
+ than the original language in audio. Values:
236
+
237
+ - disable – Do not translate.
238
+ - default – There are 3 default languages: eng,fre,ger
239
+ - \\ – Explicit language to translate to, or list of languages separated by a
240
+ comma. Look at list of available languages in description of AI ASR task
241
+ creation. If several languages are specified for translation, a separate
242
+ subtitle will be generated for each language. Example:
243
+
244
+ ```
245
+ `auto_translate_subtitles_language`: default
246
+ `auto_translate_subtitles_language`: eng,fre,ger
247
+ ```
248
+
249
+ Please note that subtitle translation is done separately and after
250
+ transcription. Thus separate AI-tasks are created for translation.
251
+
252
+ client_user_id: Custom field where you can specify user ID in your system
253
+
254
+ clip_duration_seconds: The length of the trimmed segment to transcode, instead of the entire length of
255
+ the video. Is only used in conjunction with specifying the start of a segment.
256
+ Transcoding duration is a number in seconds.
257
+
258
+ clip_start_seconds: If you want to transcode only a trimmed segment of a video instead of entire
259
+ length if the video, then you can provide timecodes of starting point and
260
+ duration of a segment to process. Start encoding from is a number in seconds.
261
+
262
+ custom_iframe_url: Deprecated. Custom URL of IFrame for video player to be used in share panel in
263
+ player. Auto generated IFrame URL provided by default
264
+
265
+ description: Video details; not visible to the end-users
266
+
267
+ directory_id: ID of the directory where the video should be uploaded. (beta)
268
+
269
+ origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a
270
+ request to download a file (specified in "`origin_url`" parameter) on an
271
+ external server. Syntax: `Authorization: ` Examples:
272
+
273
+ - "`origin_http_headers`": "Authorization: Basic ..."
274
+ - "`origin_http_headers`": "Authorization: Bearer ..."
275
+ - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when
276
+ downloading a file from Google Drive:
277
+
278
+ ```
279
+ POST https://api.gcore.com/streaming/videos
280
+ "video": {
281
+ "name": "IBC 2024 intro.mp4",
282
+ "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media",
283
+ "`origin_http_headers`": "Authorization: Bearer ABC"
284
+ }
285
+ ```
286
+
287
+ origin_url: URL to an original file which you want to copy from external storage. If
288
+ specified, system will download the file and will use it as video source for
289
+ transcoding.
290
+
291
+ poster: Poster is your own static image which can be displayed before the video starts.
292
+ After uploading the video, the system will automatically create several
293
+ screenshots (they will be stored in "screenshots" attribute) from which you can
294
+ select an default screenshot. This "poster" field is for uploading your own
295
+ image. Also use attribute "`screenshot_id`" to select poster as a default
296
+ screnshot. Attribute accepts single image as base64-encoded string
297
+ [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In
298
+ format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png
299
+ and file sizes up to 1Mb. Examples:
300
+
301
+ - `data:image/jpeg;base64,/9j/4AA...qf/2Q==`
302
+ - `data:image/png;base64,iVBORw0KGg...ggg==`
303
+ - `data:image/webp;base64,UklGRt.../DgAAAAA`
304
+
305
+ priority: Priority allows you to adjust the urgency of processing some videos before
306
+ others in your account, if your algorithm requires it. For example, when there
307
+ are very urgent video and some regular ones that can wait in the queue. Value
308
+ range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest
309
+ up-priority. Default priority is 0.
310
+
311
+ projection:
312
+ Deprecated. Regulates the video format:
313
+
314
+ - **regular** — plays the video as usual
315
+ - **vr360** — plays the video in 360 degree mode
316
+ - **vr180** — plays the video in 180 degree mode
317
+ - **vr360tb** — plays the video in 3D 360 degree mode Top-Bottom.
318
+
319
+ Default is regular
320
+
321
+ quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to
322
+ your conditions. Look at GET /`quality_sets` method
323
+
324
+ remote_poster_url: Poster URL to download from external resource, instead of uploading via "poster"
325
+ attribute. It has the same restrictions as "poster" attribute.
326
+
327
+ remove_poster: Set it to true to remove poster
328
+
329
+ screenshot_id: Default screenshot index. Specify an ID from the "screenshots" array, so that
330
+ the URL of the required screenshot appears in the "screenshot" attribute as the
331
+ default screenshot. By default 5 static screenshots will be taken from different
332
+ places in the video after transcoding. If the video is short, there may be fewer
333
+ screenshots. Counting from 0. A value of -1 sets the default screenshot to the
334
+ URL of your own image from the "poster" attribute. Look at "screenshot"
335
+ attribute in GET /videos/{`video_id`} for details.
336
+
337
+ share_url: Deprecated. Custom URL or iframe displayed in the link field when a user clicks
338
+ on a sharing button in player. If empty, the link field and social network
339
+ sharing is disabled
340
+
341
+ source_bitrate_limit: The option allows you to set the video transcoding rule so that the output
342
+ bitrate in ABR ladder is not exceeding the bitrate of the original video.
343
+
344
+ This option is for advanced users only.
345
+
346
+ By default `source_bitrate_limit: true` this option allows you to have the
347
+ output bitrate not more than in the original video, thus to transcode video
348
+ faster and to deliver it to end-viewers faster as well. At the same time, the
349
+ quality will be similar to the original. If for some reason you need more
350
+ byte-space in the output quality when encoding, you can set this option to
351
+ `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will
352
+ be raised from the bitrate of the original video to the maximum possible limit
353
+ specified in our the Product Documentation. For example, this may be needed
354
+ when:
355
+
356
+ - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics,
357
+ - to improve the picture quality on dynamic scenes,
358
+ - etc. The option is applied only at the video creation stage and cannot be
359
+ changed later. If you want to re-transcode the video using new value, then you
360
+ need to create and upload a new video only.
361
+
362
+ extra_headers: Send extra headers
363
+
364
+ extra_query: Add additional query parameters to the request
365
+
366
+ extra_body: Add additional JSON properties to the request
367
+
368
+ timeout: Override the client-level default timeout for this request, in seconds
369
+ """
370
+ return self._patch(
371
+ f"/streaming/videos/{video_id}",
372
+ body=maybe_transform(
373
+ {
374
+ "name": name,
375
+ "auto_transcribe_audio_language": auto_transcribe_audio_language,
376
+ "auto_translate_subtitles_language": auto_translate_subtitles_language,
377
+ "client_user_id": client_user_id,
378
+ "clip_duration_seconds": clip_duration_seconds,
379
+ "clip_start_seconds": clip_start_seconds,
380
+ "custom_iframe_url": custom_iframe_url,
381
+ "description": description,
382
+ "directory_id": directory_id,
383
+ "origin_http_headers": origin_http_headers,
384
+ "origin_url": origin_url,
385
+ "poster": poster,
386
+ "priority": priority,
387
+ "projection": projection,
388
+ "quality_set_id": quality_set_id,
389
+ "remote_poster_url": remote_poster_url,
390
+ "remove_poster": remove_poster,
391
+ "screenshot_id": screenshot_id,
392
+ "share_url": share_url,
393
+ "source_bitrate_limit": source_bitrate_limit,
394
+ },
395
+ video_update_params.VideoUpdateParams,
396
+ ),
397
+ options=make_request_options(
398
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
399
+ ),
400
+ cast_to=Video,
401
+ )
402
+
403
+ def list(
404
+ self,
405
+ *,
406
+ id: str | NotGiven = NOT_GIVEN,
407
+ client_user_id: int | NotGiven = NOT_GIVEN,
408
+ fields: str | NotGiven = NOT_GIVEN,
409
+ page: int | NotGiven = NOT_GIVEN,
410
+ per_page: int | NotGiven = NOT_GIVEN,
411
+ search: str | NotGiven = NOT_GIVEN,
412
+ status: str | NotGiven = NOT_GIVEN,
413
+ stream_id: int | NotGiven = NOT_GIVEN,
414
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
415
+ # The extra values given here take precedence over values defined on the client or passed to this method.
416
+ extra_headers: Headers | None = None,
417
+ extra_query: Query | None = None,
418
+ extra_body: Body | None = None,
419
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
420
+ ) -> SyncPageStreaming[Video]:
421
+ """
422
+ Returns a set of videos by the given criteria.
423
+
424
+ Args:
425
+ id: IDs of the videos to find. You can specify one or more identifiers separated by
426
+ commas. Example, ?id=1,101,1001
427
+
428
+ client_user_id: Find videos where "`client_user_id`" meta field is equal to the search value
429
+
430
+ fields: Restriction to return only the specified attributes, instead of the entire
431
+ dataset. Specify, if you need to get short response. The following fields are
432
+ available for specifying: id, name, duration, status, `created_at`,
433
+ `updated_at`, `hls_url`, screenshots, `converted_videos`, priority, `stream_id`.
434
+ Example, ?fields=id,name,`hls_url`
435
+
436
+ page: Page number. Use it to list the paginated content
437
+
438
+ per_page: Items per page number. Use it to list the paginated content
439
+
440
+ search: Aggregated search condition. If set, the video list is filtered by one combined
441
+ SQL criterion:
442
+
443
+ - id={s} OR slug={s} OR name like {s} i.e. "/videos?search=1000" returns list of
444
+ videos where id=1000 or slug=1000 or name contains "1000".
445
+
446
+ status:
447
+ Use it to get videos filtered by their status. Possible values:
448
+
449
+ - empty
450
+ - pending
451
+ - viewable
452
+ - ready
453
+ - error
454
+
455
+ stream_id: Find videos recorded from a specific stream, so for which "`stream_id`" field is
456
+ equal to the search value
457
+
458
+ extra_headers: Send extra headers
459
+
460
+ extra_query: Add additional query parameters to the request
461
+
462
+ extra_body: Add additional JSON properties to the request
463
+
464
+ timeout: Override the client-level default timeout for this request, in seconds
465
+ """
466
+ return self._get_api_list(
467
+ "/streaming/videos",
468
+ page=SyncPageStreaming[Video],
469
+ options=make_request_options(
470
+ extra_headers=extra_headers,
471
+ extra_query=extra_query,
472
+ extra_body=extra_body,
473
+ timeout=timeout,
474
+ query=maybe_transform(
475
+ {
476
+ "id": id,
477
+ "client_user_id": client_user_id,
478
+ "fields": fields,
479
+ "page": page,
480
+ "per_page": per_page,
481
+ "search": search,
482
+ "status": status,
483
+ "stream_id": stream_id,
484
+ },
485
+ video_list_params.VideoListParams,
486
+ ),
487
+ ),
488
+ model=Video,
489
+ )
490
+
491
+ def delete(
492
+ self,
493
+ video_id: int,
494
+ *,
495
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
496
+ # The extra values given here take precedence over values defined on the client or passed to this method.
497
+ extra_headers: Headers | None = None,
498
+ extra_query: Query | None = None,
499
+ extra_body: Body | None = None,
500
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
501
+ ) -> None:
502
+ """
503
+ Operation to delete video entity.
504
+
505
+ When you delete a video, all transcoded qualities and all associated files such
506
+ as subtitles and screenshots, as well as other data, are deleted from cloud
507
+ storage. The video is deleted permanently and irreversibly. Therefore, it is
508
+ impossible to restore files after this.
509
+
510
+ For detailed information and information on calculating your maximum monthly
511
+ storage usage, please refer to the Product Documentation.
512
+
513
+ Args:
514
+ extra_headers: Send extra headers
515
+
516
+ extra_query: Add additional query parameters to the request
517
+
518
+ extra_body: Add additional JSON properties to the request
519
+
520
+ timeout: Override the client-level default timeout for this request, in seconds
521
+ """
522
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
523
+ return self._delete(
524
+ f"/streaming/videos/{video_id}",
525
+ options=make_request_options(
526
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
527
+ ),
528
+ cast_to=NoneType,
529
+ )
530
+
531
+ def create_multiple(
532
+ self,
533
+ *,
534
+ fields: str | NotGiven = NOT_GIVEN,
535
+ videos: Iterable[video_create_multiple_params.Video] | NotGiven = NOT_GIVEN,
536
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
537
+ # The extra values given here take precedence over values defined on the client or passed to this method.
538
+ extra_headers: Headers | None = None,
539
+ extra_query: Query | None = None,
540
+ extra_body: Body | None = None,
541
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
542
+ ) -> VideoCreateMultipleResponse:
543
+ """Mass upload of your videos.
544
+
545
+ Method is used to set the task of creating videos in
546
+ the form of 1 aggregated request instead of a large number of single requests.
547
+
548
+ An additional advantage is the ability to specify subtitles in the same request.
549
+ Whereas for a normal single upload, subtitles are uploaded in separate requests.
550
+
551
+ All videos in the request will be processed in queue in order of priority. Use
552
+ "priority" attribute and look at general description in POST /videos method.
553
+ Limits:
554
+
555
+ - Batch max size = 500 videos.
556
+ - Max body size (payload) = 64MB.
557
+ - API connection timeout = 30 sec.
558
+
559
+ Args:
560
+ fields: Restriction to return only the specified attributes, instead of the entire
561
+ dataset. Specify, if you need to get short response. The following fields are
562
+ available for specifying: id, name, duration, status, `created_at`,
563
+ `updated_at`, `hls_url`, screenshots, `converted_videos`, priority. Example,
564
+ ?fields=id,name,`hls_url`
565
+
566
+ extra_headers: Send extra headers
567
+
568
+ extra_query: Add additional query parameters to the request
569
+
570
+ extra_body: Add additional JSON properties to the request
571
+
572
+ timeout: Override the client-level default timeout for this request, in seconds
573
+ """
574
+ return self._post(
575
+ "/streaming/videos/batch",
576
+ body=maybe_transform({"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams),
577
+ options=make_request_options(
578
+ extra_headers=extra_headers,
579
+ extra_query=extra_query,
580
+ extra_body=extra_body,
581
+ timeout=timeout,
582
+ query=maybe_transform({"fields": fields}, video_create_multiple_params.VideoCreateMultipleParams),
583
+ ),
584
+ cast_to=VideoCreateMultipleResponse,
585
+ )
586
+
587
+ def get(
588
+ self,
589
+ video_id: int,
590
+ *,
591
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
592
+ # The extra values given here take precedence over values defined on the client or passed to this method.
593
+ extra_headers: Headers | None = None,
594
+ extra_query: Query | None = None,
595
+ extra_body: Body | None = None,
596
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
597
+ ) -> Video:
598
+ """Information about a video entity.
599
+
600
+ Contains all the data about the video:
601
+ meta-data, data for streaming and renditions, static media data, data about
602
+ original video. You can use different methods to play video:
603
+
604
+ - `iframe_url` – a URL to a built-in HTML video player with automatically
605
+ configured video playback.
606
+ - `hls_url` – a URLs to HLS TS .m3u8 manifest, which can be played in video
607
+ players.
608
+ - `hls_cmaf_url` – a URL to HLS CMAF .m3u8 manifest with chunks in fMP4 format,
609
+ which can be played in most modern video players.
610
+ - `dash_url` – a URL to MPEG-DASH .mpd manifest, which can be played in most
611
+ modern video players. Preferable for Android and Windows devices.
612
+ - `converted_videos`/`mp4_url` – a URL to MP4 file of specific rendition.
613
+ ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg)
614
+
615
+ Args:
616
+ extra_headers: Send extra headers
617
+
618
+ extra_query: Add additional query parameters to the request
619
+
620
+ extra_body: Add additional JSON properties to the request
621
+
622
+ timeout: Override the client-level default timeout for this request, in seconds
623
+ """
624
+ return self._get(
625
+ f"/streaming/videos/{video_id}",
626
+ options=make_request_options(
627
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
628
+ ),
629
+ cast_to=Video,
630
+ )
631
+
632
+ def get_parameters_for_direct_upload(
633
+ self,
634
+ video_id: int,
635
+ *,
636
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
637
+ # The extra values given here take precedence over values defined on the client or passed to this method.
638
+ extra_headers: Headers | None = None,
639
+ extra_query: Query | None = None,
640
+ extra_body: Body | None = None,
641
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
642
+ ) -> DirectUploadParameters:
643
+ """
644
+ Use this method to get TUS' session parameters: hostname of the server to
645
+ upload, secure token. The general sequence of actions for a direct upload of a
646
+ video is as follows:
647
+
648
+ - Create video entity via POST method
649
+ ["Create video"](/docs/api-reference/streaming/videos/create-video)
650
+ - Get TUS' session parameters (you are here now)
651
+ - Upload file via TUS client, choose your implementation on
652
+ [tus.io](https://tus.io/implementations) Final endpoint for uploading is
653
+ constructed using the following template: "https://{hostname}/upload/". Also
654
+ you have to provide token, `client_id`, `video_id` as metadata too. A short
655
+ javascript example is shown below, based on tus-js-client. Variable "data"
656
+ below is the result of this API request. Please, note that we support 2.x
657
+ version only of tus-js-client.
658
+
659
+ ```
660
+ uploads[data.video.id] = new tus.Upload(file, {
661
+ endpoint: `https://${data.servers[0].hostname}/upload/`,
662
+ metadata: {
663
+ filename: data.video.name,
664
+ token: data.token,
665
+ `video_id`: data.video.id,
666
+ `client_id`: data.video.`client_id`
667
+ },
668
+ onSuccess: function() {
669
+ ...
670
+ }
671
+ }
672
+ uploads[data.video.id].start();
673
+ ```
674
+
675
+ Args:
676
+ extra_headers: Send extra headers
677
+
678
+ extra_query: Add additional query parameters to the request
679
+
680
+ extra_body: Add additional JSON properties to the request
681
+
682
+ timeout: Override the client-level default timeout for this request, in seconds
683
+ """
684
+ return self._get(
685
+ f"/streaming/videos/{video_id}/upload",
686
+ options=make_request_options(
687
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
688
+ ),
689
+ cast_to=DirectUploadParameters,
690
+ )
691
+
692
+ def list_names(
693
+ self,
694
+ *,
695
+ ids: Iterable[int] | NotGiven = NOT_GIVEN,
696
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
697
+ # The extra values given here take precedence over values defined on the client or passed to this method.
698
+ extra_headers: Headers | None = None,
699
+ extra_query: Query | None = None,
700
+ extra_body: Body | None = None,
701
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
702
+ ) -> None:
703
+ """
704
+ Returns names for specified video IDs
705
+
706
+ Args:
707
+ ids: Comma-separated set of video IDs. Example, ?ids=7,17
708
+
709
+ extra_headers: Send extra headers
710
+
711
+ extra_query: Add additional query parameters to the request
712
+
713
+ extra_body: Add additional JSON properties to the request
714
+
715
+ timeout: Override the client-level default timeout for this request, in seconds
716
+ """
717
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
718
+ return self._get(
719
+ "/streaming/videos/names",
720
+ options=make_request_options(
721
+ extra_headers=extra_headers,
722
+ extra_query=extra_query,
723
+ extra_body=extra_body,
724
+ timeout=timeout,
725
+ query=maybe_transform({"ids": ids}, video_list_names_params.VideoListNamesParams),
726
+ ),
727
+ cast_to=NoneType,
728
+ )
729
+
730
+
731
+ class AsyncVideosResource(AsyncAPIResource):
732
+ @cached_property
733
+ def subtitles(self) -> AsyncSubtitlesResource:
734
+ return AsyncSubtitlesResource(self._client)
735
+
736
+ @cached_property
737
+ def with_raw_response(self) -> AsyncVideosResourceWithRawResponse:
738
+ """
739
+ This property can be used as a prefix for any HTTP method call to return
740
+ the raw response object instead of the parsed content.
741
+
742
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
743
+ """
744
+ return AsyncVideosResourceWithRawResponse(self)
745
+
746
+ @cached_property
747
+ def with_streaming_response(self) -> AsyncVideosResourceWithStreamingResponse:
748
+ """
749
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
750
+
751
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
752
+ """
753
+ return AsyncVideosResourceWithStreamingResponse(self)
754
+
755
+ async def create(
756
+ self,
757
+ *,
758
+ video: CreateVideoParam | NotGiven = NOT_GIVEN,
759
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
760
+ # The extra values given here take precedence over values defined on the client or passed to this method.
761
+ extra_headers: Headers | None = None,
762
+ extra_query: Query | None = None,
763
+ extra_body: Body | None = None,
764
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
765
+ ) -> VideoCreateResponse:
766
+ """
767
+ Use this method to create a new video entity.
768
+
769
+ **Methods of creating** To upload the original video file to the server, there
770
+ are several possible scenarios:
771
+
772
+ - **Copy from another server** – If your video is accessable via "http://",
773
+ "https://", or "sftp://" public link, then you can use this method to copy a
774
+ file from an external server. Set `origin_url` parameter with the link to the
775
+ original video file (i.e. "https://domain.com/video.mp4"). After method
776
+ execution file will be uploaded and will be sent to transcoding automatically,
777
+ you don't have to do anything else. Use extra field `origin_http_headers` if
778
+ authorization is required on the external server.
779
+ - **Direct upload from a local device** – If you need to upload video directly
780
+ from your local device or from a mobile app, then use this method. Keep
781
+ `origin_url` empty and use TUS protocol ([tus.io](https://tus.io)) to upload
782
+ file. More details are here
783
+ ["Get TUS' upload"](/docs/api-reference/streaming/videos/get-tus-parameters-for-direct-upload)
784
+ After getting the video, it is processed through the queue. There are 2
785
+ priority criteria: global and local. Global is determined automatically by the
786
+ system as converters are ready to get next video, so your videos rarely queue
787
+ longer than usual (when you don't have a dedicated region). Local priority
788
+ works at the level of your account and you have full control over it, look at
789
+ "priority" attribute.
790
+
791
+ **AI processing** When uploading a video, it is possible to automatically create
792
+ subtitles based on AI. Read more:
793
+
794
+ - What is
795
+ ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task).
796
+ - If the option is enabled via `auto_transcribe_audio_language: auto|`, then
797
+ immediately after successful transcoding, an AI task will be automatically
798
+ created for transcription.
799
+ - If you need to translate subtitles from original language to any other, then
800
+ AI-task of subtitles translation can be applied. Use
801
+ `auto_translate_subtitles_language: default|` parameter for that. Also you can
802
+ point several languages to translate to, then a separate subtitle will be
803
+ generated for each specified language.
804
+ - How to
805
+ ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle).
806
+ The created AI-task(s) will be automatically executed, and result will also be
807
+ automatically attached to this video as subtitle(s). Please note that
808
+ transcription is done automatically for all videos uploaded to our video
809
+ hosting. If necessary, you can disable automatic creation of subtitles. If AI
810
+ is disabled in your account, no AI functionality is called.
811
+
812
+ **Advanced Features** For details on the requirements for incoming original
813
+ files, and output video parameters after transcoding, refer to the Knowledge
814
+ Base documentation. By default video will be transcoded according to the
815
+ original resolution, and a quality ladder suitable for your original video will
816
+ be applied. There is no automatic upscaling; the maximum quality is taken from
817
+ the original video. If you want to upload specific files not explicitly listed
818
+ in requirements or wish to modify the standard quality ladder (i.e. decrease
819
+ quality or add new non-standard qualities), then such customization is possible.
820
+ Please reach out to us for assistance.
821
+
822
+ Additionally, check the Knowledge Base for any supplementary information you may
823
+ need.
824
+
825
+ Args:
826
+ extra_headers: Send extra headers
827
+
828
+ extra_query: Add additional query parameters to the request
829
+
830
+ extra_body: Add additional JSON properties to the request
831
+
832
+ timeout: Override the client-level default timeout for this request, in seconds
833
+ """
834
+ return await self._post(
835
+ "/streaming/videos",
836
+ body=await async_maybe_transform({"video": video}, video_create_params.VideoCreateParams),
837
+ options=make_request_options(
838
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
839
+ ),
840
+ cast_to=VideoCreateResponse,
841
+ )
842
+
843
+ async def update(
844
+ self,
845
+ video_id: int,
846
+ *,
847
+ name: str,
848
+ auto_transcribe_audio_language: Literal["disable", "auto", "<language_code>"] | NotGiven = NOT_GIVEN,
849
+ auto_translate_subtitles_language: Literal["disable", "default", "<language_codes,>"] | NotGiven = NOT_GIVEN,
850
+ client_user_id: int | NotGiven = NOT_GIVEN,
851
+ clip_duration_seconds: int | NotGiven = NOT_GIVEN,
852
+ clip_start_seconds: int | NotGiven = NOT_GIVEN,
853
+ custom_iframe_url: str | NotGiven = NOT_GIVEN,
854
+ description: str | NotGiven = NOT_GIVEN,
855
+ directory_id: int | NotGiven = NOT_GIVEN,
856
+ origin_http_headers: str | NotGiven = NOT_GIVEN,
857
+ origin_url: str | NotGiven = NOT_GIVEN,
858
+ poster: str | NotGiven = NOT_GIVEN,
859
+ priority: int | NotGiven = NOT_GIVEN,
860
+ projection: str | NotGiven = NOT_GIVEN,
861
+ quality_set_id: int | NotGiven = NOT_GIVEN,
862
+ remote_poster_url: str | NotGiven = NOT_GIVEN,
863
+ remove_poster: bool | NotGiven = NOT_GIVEN,
864
+ screenshot_id: int | NotGiven = NOT_GIVEN,
865
+ share_url: str | NotGiven = NOT_GIVEN,
866
+ source_bitrate_limit: bool | NotGiven = NOT_GIVEN,
867
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
868
+ # The extra values given here take precedence over values defined on the client or passed to this method.
869
+ extra_headers: Headers | None = None,
870
+ extra_query: Query | None = None,
871
+ extra_body: Body | None = None,
872
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
873
+ ) -> Video:
874
+ """Changes parameters of the video to new values.
875
+
876
+ It's allowed to update only those
877
+ public parameters that are described in POST method to create a new “video”
878
+ entity. So it's not possible to change calculated parameters like "id",
879
+ "duration", "`hls_url`", etc. Examples of changing:
880
+
881
+ - Name: `{ "name": "new name of the video" }`
882
+ - Move the video to a new directory: `` { "`directory_id`": 200 }`` Please note
883
+ that some parameters are used on initial step (before transcoding) only, so
884
+ after transcoding there is no use in changing their values. For example,
885
+ "`origin_url`" parameter is used for downloading an original file from a
886
+ source and never used after transcoding; or "priority" parameter is used to
887
+ set priority of processing and never used after transcoding.
888
+
889
+ Args:
890
+ name: Video name
891
+
892
+ auto_transcribe_audio_language:
893
+ Automatic creation of subtitles by transcribing the audio track. Values:
894
+
895
+ - disable – Do not transcribe.
896
+ - auto – Automatically detects the activation of the option based on the
897
+ settings in your account. If generation is activated, then automatic language
898
+ detection while transcribing.
899
+ - \\ – Transcribe from specific language. Can be used to specify the exact
900
+ language spoken in the audio track, or when auto language detection fails.
901
+ Language is set by 3-letter language code according to ISO-639-2
902
+ (bibliographic code). List of languages is available in `audio_language`
903
+ attribute of API POST /streaming/ai/transcribe . Example:
904
+
905
+ ```
906
+ `auto_transcribe_audio_language`: "auto"
907
+ `auto_transcribe_audio_language`: "ger"
908
+ ```
909
+
910
+ More details:
911
+
912
+ - List of AI tasks – API
913
+ [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result)
914
+ - Add subtitles to an exist video – API
915
+ [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle).
916
+
917
+ auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified
918
+ language(s). Can be used both together with `auto_transcribe_audio_language`
919
+ option only. Use it when you want to make automatic subtitles in languages other
920
+ than the original language in audio. Values:
921
+
922
+ - disable – Do not translate.
923
+ - default – There are 3 default languages: eng,fre,ger
924
+ - \\ – Explicit language to translate to, or list of languages separated by a
925
+ comma. Look at list of available languages in description of AI ASR task
926
+ creation. If several languages are specified for translation, a separate
927
+ subtitle will be generated for each language. Example:
928
+
929
+ ```
930
+ `auto_translate_subtitles_language`: default
931
+ `auto_translate_subtitles_language`: eng,fre,ger
932
+ ```
933
+
934
+ Please note that subtitle translation is done separately and after
935
+ transcription. Thus separate AI-tasks are created for translation.
936
+
937
+ client_user_id: Custom field where you can specify user ID in your system
938
+
939
+ clip_duration_seconds: The length of the trimmed segment to transcode, instead of the entire length of
940
+ the video. Is only used in conjunction with specifying the start of a segment.
941
+ Transcoding duration is a number in seconds.
942
+
943
+ clip_start_seconds: If you want to transcode only a trimmed segment of a video instead of entire
944
+ length if the video, then you can provide timecodes of starting point and
945
+ duration of a segment to process. Start encoding from is a number in seconds.
946
+
947
+ custom_iframe_url: Deprecated. Custom URL of IFrame for video player to be used in share panel in
948
+ player. Auto generated IFrame URL provided by default
949
+
950
+ description: Video details; not visible to the end-users
951
+
952
+ directory_id: ID of the directory where the video should be uploaded. (beta)
953
+
954
+ origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a
955
+ request to download a file (specified in "`origin_url`" parameter) on an
956
+ external server. Syntax: `Authorization: ` Examples:
957
+
958
+ - "`origin_http_headers`": "Authorization: Basic ..."
959
+ - "`origin_http_headers`": "Authorization: Bearer ..."
960
+ - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when
961
+ downloading a file from Google Drive:
962
+
963
+ ```
964
+ POST https://api.gcore.com/streaming/videos
965
+ "video": {
966
+ "name": "IBC 2024 intro.mp4",
967
+ "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media",
968
+ "`origin_http_headers`": "Authorization: Bearer ABC"
969
+ }
970
+ ```
971
+
972
+ origin_url: URL to an original file which you want to copy from external storage. If
973
+ specified, system will download the file and will use it as video source for
974
+ transcoding.
975
+
976
+ poster: Poster is your own static image which can be displayed before the video starts.
977
+ After uploading the video, the system will automatically create several
978
+ screenshots (they will be stored in "screenshots" attribute) from which you can
979
+ select an default screenshot. This "poster" field is for uploading your own
980
+ image. Also use attribute "`screenshot_id`" to select poster as a default
981
+ screnshot. Attribute accepts single image as base64-encoded string
982
+ [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In
983
+ format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png
984
+ and file sizes up to 1Mb. Examples:
985
+
986
+ - `data:image/jpeg;base64,/9j/4AA...qf/2Q==`
987
+ - `data:image/png;base64,iVBORw0KGg...ggg==`
988
+ - `data:image/webp;base64,UklGRt.../DgAAAAA`
989
+
990
+ priority: Priority allows you to adjust the urgency of processing some videos before
991
+ others in your account, if your algorithm requires it. For example, when there
992
+ are very urgent video and some regular ones that can wait in the queue. Value
993
+ range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest
994
+ up-priority. Default priority is 0.
995
+
996
+ projection:
997
+ Deprecated. Regulates the video format:
998
+
999
+ - **regular** — plays the video as usual
1000
+ - **vr360** — plays the video in 360 degree mode
1001
+ - **vr180** — plays the video in 180 degree mode
1002
+ - **vr360tb** — plays the video in 3D 360 degree mode Top-Bottom.
1003
+
1004
+ Default is regular
1005
+
1006
+ quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to
1007
+ your conditions. Look at GET /`quality_sets` method
1008
+
1009
+ remote_poster_url: Poster URL to download from external resource, instead of uploading via "poster"
1010
+ attribute. It has the same restrictions as "poster" attribute.
1011
+
1012
+ remove_poster: Set it to true to remove poster
1013
+
1014
+ screenshot_id: Default screenshot index. Specify an ID from the "screenshots" array, so that
1015
+ the URL of the required screenshot appears in the "screenshot" attribute as the
1016
+ default screenshot. By default 5 static screenshots will be taken from different
1017
+ places in the video after transcoding. If the video is short, there may be fewer
1018
+ screenshots. Counting from 0. A value of -1 sets the default screenshot to the
1019
+ URL of your own image from the "poster" attribute. Look at "screenshot"
1020
+ attribute in GET /videos/{`video_id`} for details.
1021
+
1022
+ share_url: Deprecated. Custom URL or iframe displayed in the link field when a user clicks
1023
+ on a sharing button in player. If empty, the link field and social network
1024
+ sharing is disabled
1025
+
1026
+ source_bitrate_limit: The option allows you to set the video transcoding rule so that the output
1027
+ bitrate in ABR ladder is not exceeding the bitrate of the original video.
1028
+
1029
+ This option is for advanced users only.
1030
+
1031
+ By default `source_bitrate_limit: true` this option allows you to have the
1032
+ output bitrate not more than in the original video, thus to transcode video
1033
+ faster and to deliver it to end-viewers faster as well. At the same time, the
1034
+ quality will be similar to the original. If for some reason you need more
1035
+ byte-space in the output quality when encoding, you can set this option to
1036
+ `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will
1037
+ be raised from the bitrate of the original video to the maximum possible limit
1038
+ specified in our the Product Documentation. For example, this may be needed
1039
+ when:
1040
+
1041
+ - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics,
1042
+ - to improve the picture quality on dynamic scenes,
1043
+ - etc. The option is applied only at the video creation stage and cannot be
1044
+ changed later. If you want to re-transcode the video using new value, then you
1045
+ need to create and upload a new video only.
1046
+
1047
+ extra_headers: Send extra headers
1048
+
1049
+ extra_query: Add additional query parameters to the request
1050
+
1051
+ extra_body: Add additional JSON properties to the request
1052
+
1053
+ timeout: Override the client-level default timeout for this request, in seconds
1054
+ """
1055
+ return await self._patch(
1056
+ f"/streaming/videos/{video_id}",
1057
+ body=await async_maybe_transform(
1058
+ {
1059
+ "name": name,
1060
+ "auto_transcribe_audio_language": auto_transcribe_audio_language,
1061
+ "auto_translate_subtitles_language": auto_translate_subtitles_language,
1062
+ "client_user_id": client_user_id,
1063
+ "clip_duration_seconds": clip_duration_seconds,
1064
+ "clip_start_seconds": clip_start_seconds,
1065
+ "custom_iframe_url": custom_iframe_url,
1066
+ "description": description,
1067
+ "directory_id": directory_id,
1068
+ "origin_http_headers": origin_http_headers,
1069
+ "origin_url": origin_url,
1070
+ "poster": poster,
1071
+ "priority": priority,
1072
+ "projection": projection,
1073
+ "quality_set_id": quality_set_id,
1074
+ "remote_poster_url": remote_poster_url,
1075
+ "remove_poster": remove_poster,
1076
+ "screenshot_id": screenshot_id,
1077
+ "share_url": share_url,
1078
+ "source_bitrate_limit": source_bitrate_limit,
1079
+ },
1080
+ video_update_params.VideoUpdateParams,
1081
+ ),
1082
+ options=make_request_options(
1083
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1084
+ ),
1085
+ cast_to=Video,
1086
+ )
1087
+
1088
+ def list(
1089
+ self,
1090
+ *,
1091
+ id: str | NotGiven = NOT_GIVEN,
1092
+ client_user_id: int | NotGiven = NOT_GIVEN,
1093
+ fields: str | NotGiven = NOT_GIVEN,
1094
+ page: int | NotGiven = NOT_GIVEN,
1095
+ per_page: int | NotGiven = NOT_GIVEN,
1096
+ search: str | NotGiven = NOT_GIVEN,
1097
+ status: str | NotGiven = NOT_GIVEN,
1098
+ stream_id: int | NotGiven = NOT_GIVEN,
1099
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1100
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1101
+ extra_headers: Headers | None = None,
1102
+ extra_query: Query | None = None,
1103
+ extra_body: Body | None = None,
1104
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1105
+ ) -> AsyncPaginator[Video, AsyncPageStreaming[Video]]:
1106
+ """
1107
+ Returns a set of videos by the given criteria.
1108
+
1109
+ Args:
1110
+ id: IDs of the videos to find. You can specify one or more identifiers separated by
1111
+ commas. Example, ?id=1,101,1001
1112
+
1113
+ client_user_id: Find videos where "`client_user_id`" meta field is equal to the search value
1114
+
1115
+ fields: Restriction to return only the specified attributes, instead of the entire
1116
+ dataset. Specify, if you need to get short response. The following fields are
1117
+ available for specifying: id, name, duration, status, `created_at`,
1118
+ `updated_at`, `hls_url`, screenshots, `converted_videos`, priority, `stream_id`.
1119
+ Example, ?fields=id,name,`hls_url`
1120
+
1121
+ page: Page number. Use it to list the paginated content
1122
+
1123
+ per_page: Items per page number. Use it to list the paginated content
1124
+
1125
+ search: Aggregated search condition. If set, the video list is filtered by one combined
1126
+ SQL criterion:
1127
+
1128
+ - id={s} OR slug={s} OR name like {s} i.e. "/videos?search=1000" returns list of
1129
+ videos where id=1000 or slug=1000 or name contains "1000".
1130
+
1131
+ status:
1132
+ Use it to get videos filtered by their status. Possible values:
1133
+
1134
+ - empty
1135
+ - pending
1136
+ - viewable
1137
+ - ready
1138
+ - error
1139
+
1140
+ stream_id: Find videos recorded from a specific stream, so for which "`stream_id`" field is
1141
+ equal to the search value
1142
+
1143
+ extra_headers: Send extra headers
1144
+
1145
+ extra_query: Add additional query parameters to the request
1146
+
1147
+ extra_body: Add additional JSON properties to the request
1148
+
1149
+ timeout: Override the client-level default timeout for this request, in seconds
1150
+ """
1151
+ return self._get_api_list(
1152
+ "/streaming/videos",
1153
+ page=AsyncPageStreaming[Video],
1154
+ options=make_request_options(
1155
+ extra_headers=extra_headers,
1156
+ extra_query=extra_query,
1157
+ extra_body=extra_body,
1158
+ timeout=timeout,
1159
+ query=maybe_transform(
1160
+ {
1161
+ "id": id,
1162
+ "client_user_id": client_user_id,
1163
+ "fields": fields,
1164
+ "page": page,
1165
+ "per_page": per_page,
1166
+ "search": search,
1167
+ "status": status,
1168
+ "stream_id": stream_id,
1169
+ },
1170
+ video_list_params.VideoListParams,
1171
+ ),
1172
+ ),
1173
+ model=Video,
1174
+ )
1175
+
1176
+ async def delete(
1177
+ self,
1178
+ video_id: int,
1179
+ *,
1180
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1181
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1182
+ extra_headers: Headers | None = None,
1183
+ extra_query: Query | None = None,
1184
+ extra_body: Body | None = None,
1185
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1186
+ ) -> None:
1187
+ """
1188
+ Operation to delete video entity.
1189
+
1190
+ When you delete a video, all transcoded qualities and all associated files such
1191
+ as subtitles and screenshots, as well as other data, are deleted from cloud
1192
+ storage. The video is deleted permanently and irreversibly. Therefore, it is
1193
+ impossible to restore files after this.
1194
+
1195
+ For detailed information and information on calculating your maximum monthly
1196
+ storage usage, please refer to the Product Documentation.
1197
+
1198
+ Args:
1199
+ extra_headers: Send extra headers
1200
+
1201
+ extra_query: Add additional query parameters to the request
1202
+
1203
+ extra_body: Add additional JSON properties to the request
1204
+
1205
+ timeout: Override the client-level default timeout for this request, in seconds
1206
+ """
1207
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1208
+ return await self._delete(
1209
+ f"/streaming/videos/{video_id}",
1210
+ options=make_request_options(
1211
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1212
+ ),
1213
+ cast_to=NoneType,
1214
+ )
1215
+
1216
+ async def create_multiple(
1217
+ self,
1218
+ *,
1219
+ fields: str | NotGiven = NOT_GIVEN,
1220
+ videos: Iterable[video_create_multiple_params.Video] | NotGiven = NOT_GIVEN,
1221
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1222
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1223
+ extra_headers: Headers | None = None,
1224
+ extra_query: Query | None = None,
1225
+ extra_body: Body | None = None,
1226
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1227
+ ) -> VideoCreateMultipleResponse:
1228
+ """Mass upload of your videos.
1229
+
1230
+ Method is used to set the task of creating videos in
1231
+ the form of 1 aggregated request instead of a large number of single requests.
1232
+
1233
+ An additional advantage is the ability to specify subtitles in the same request.
1234
+ Whereas for a normal single upload, subtitles are uploaded in separate requests.
1235
+
1236
+ All videos in the request will be processed in queue in order of priority. Use
1237
+ "priority" attribute and look at general description in POST /videos method.
1238
+ Limits:
1239
+
1240
+ - Batch max size = 500 videos.
1241
+ - Max body size (payload) = 64MB.
1242
+ - API connection timeout = 30 sec.
1243
+
1244
+ Args:
1245
+ fields: Restriction to return only the specified attributes, instead of the entire
1246
+ dataset. Specify, if you need to get short response. The following fields are
1247
+ available for specifying: id, name, duration, status, `created_at`,
1248
+ `updated_at`, `hls_url`, screenshots, `converted_videos`, priority. Example,
1249
+ ?fields=id,name,`hls_url`
1250
+
1251
+ extra_headers: Send extra headers
1252
+
1253
+ extra_query: Add additional query parameters to the request
1254
+
1255
+ extra_body: Add additional JSON properties to the request
1256
+
1257
+ timeout: Override the client-level default timeout for this request, in seconds
1258
+ """
1259
+ return await self._post(
1260
+ "/streaming/videos/batch",
1261
+ body=await async_maybe_transform(
1262
+ {"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams
1263
+ ),
1264
+ options=make_request_options(
1265
+ extra_headers=extra_headers,
1266
+ extra_query=extra_query,
1267
+ extra_body=extra_body,
1268
+ timeout=timeout,
1269
+ query=await async_maybe_transform(
1270
+ {"fields": fields}, video_create_multiple_params.VideoCreateMultipleParams
1271
+ ),
1272
+ ),
1273
+ cast_to=VideoCreateMultipleResponse,
1274
+ )
1275
+
1276
+ async def get(
1277
+ self,
1278
+ video_id: int,
1279
+ *,
1280
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1281
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1282
+ extra_headers: Headers | None = None,
1283
+ extra_query: Query | None = None,
1284
+ extra_body: Body | None = None,
1285
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1286
+ ) -> Video:
1287
+ """Information about a video entity.
1288
+
1289
+ Contains all the data about the video:
1290
+ meta-data, data for streaming and renditions, static media data, data about
1291
+ original video. You can use different methods to play video:
1292
+
1293
+ - `iframe_url` – a URL to a built-in HTML video player with automatically
1294
+ configured video playback.
1295
+ - `hls_url` – a URLs to HLS TS .m3u8 manifest, which can be played in video
1296
+ players.
1297
+ - `hls_cmaf_url` – a URL to HLS CMAF .m3u8 manifest with chunks in fMP4 format,
1298
+ which can be played in most modern video players.
1299
+ - `dash_url` – a URL to MPEG-DASH .mpd manifest, which can be played in most
1300
+ modern video players. Preferable for Android and Windows devices.
1301
+ - `converted_videos`/`mp4_url` – a URL to MP4 file of specific rendition.
1302
+ ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg)
1303
+
1304
+ Args:
1305
+ extra_headers: Send extra headers
1306
+
1307
+ extra_query: Add additional query parameters to the request
1308
+
1309
+ extra_body: Add additional JSON properties to the request
1310
+
1311
+ timeout: Override the client-level default timeout for this request, in seconds
1312
+ """
1313
+ return await self._get(
1314
+ f"/streaming/videos/{video_id}",
1315
+ options=make_request_options(
1316
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1317
+ ),
1318
+ cast_to=Video,
1319
+ )
1320
+
1321
+ async def get_parameters_for_direct_upload(
1322
+ self,
1323
+ video_id: int,
1324
+ *,
1325
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1326
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1327
+ extra_headers: Headers | None = None,
1328
+ extra_query: Query | None = None,
1329
+ extra_body: Body | None = None,
1330
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1331
+ ) -> DirectUploadParameters:
1332
+ """
1333
+ Use this method to get TUS' session parameters: hostname of the server to
1334
+ upload, secure token. The general sequence of actions for a direct upload of a
1335
+ video is as follows:
1336
+
1337
+ - Create video entity via POST method
1338
+ ["Create video"](/docs/api-reference/streaming/videos/create-video)
1339
+ - Get TUS' session parameters (you are here now)
1340
+ - Upload file via TUS client, choose your implementation on
1341
+ [tus.io](https://tus.io/implementations) Final endpoint for uploading is
1342
+ constructed using the following template: "https://{hostname}/upload/". Also
1343
+ you have to provide token, `client_id`, `video_id` as metadata too. A short
1344
+ javascript example is shown below, based on tus-js-client. Variable "data"
1345
+ below is the result of this API request. Please, note that we support 2.x
1346
+ version only of tus-js-client.
1347
+
1348
+ ```
1349
+ uploads[data.video.id] = new tus.Upload(file, {
1350
+ endpoint: `https://${data.servers[0].hostname}/upload/`,
1351
+ metadata: {
1352
+ filename: data.video.name,
1353
+ token: data.token,
1354
+ `video_id`: data.video.id,
1355
+ `client_id`: data.video.`client_id`
1356
+ },
1357
+ onSuccess: function() {
1358
+ ...
1359
+ }
1360
+ }
1361
+ uploads[data.video.id].start();
1362
+ ```
1363
+
1364
+ Args:
1365
+ extra_headers: Send extra headers
1366
+
1367
+ extra_query: Add additional query parameters to the request
1368
+
1369
+ extra_body: Add additional JSON properties to the request
1370
+
1371
+ timeout: Override the client-level default timeout for this request, in seconds
1372
+ """
1373
+ return await self._get(
1374
+ f"/streaming/videos/{video_id}/upload",
1375
+ options=make_request_options(
1376
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1377
+ ),
1378
+ cast_to=DirectUploadParameters,
1379
+ )
1380
+
1381
+ async def list_names(
1382
+ self,
1383
+ *,
1384
+ ids: Iterable[int] | NotGiven = NOT_GIVEN,
1385
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1386
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1387
+ extra_headers: Headers | None = None,
1388
+ extra_query: Query | None = None,
1389
+ extra_body: Body | None = None,
1390
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1391
+ ) -> None:
1392
+ """
1393
+ Returns names for specified video IDs
1394
+
1395
+ Args:
1396
+ ids: Comma-separated set of video IDs. Example, ?ids=7,17
1397
+
1398
+ extra_headers: Send extra headers
1399
+
1400
+ extra_query: Add additional query parameters to the request
1401
+
1402
+ extra_body: Add additional JSON properties to the request
1403
+
1404
+ timeout: Override the client-level default timeout for this request, in seconds
1405
+ """
1406
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1407
+ return await self._get(
1408
+ "/streaming/videos/names",
1409
+ options=make_request_options(
1410
+ extra_headers=extra_headers,
1411
+ extra_query=extra_query,
1412
+ extra_body=extra_body,
1413
+ timeout=timeout,
1414
+ query=await async_maybe_transform({"ids": ids}, video_list_names_params.VideoListNamesParams),
1415
+ ),
1416
+ cast_to=NoneType,
1417
+ )
1418
+
1419
+
1420
+ class VideosResourceWithRawResponse:
1421
+ def __init__(self, videos: VideosResource) -> None:
1422
+ self._videos = videos
1423
+
1424
+ self.create = to_raw_response_wrapper(
1425
+ videos.create,
1426
+ )
1427
+ self.update = to_raw_response_wrapper(
1428
+ videos.update,
1429
+ )
1430
+ self.list = to_raw_response_wrapper(
1431
+ videos.list,
1432
+ )
1433
+ self.delete = to_raw_response_wrapper(
1434
+ videos.delete,
1435
+ )
1436
+ self.create_multiple = to_raw_response_wrapper(
1437
+ videos.create_multiple,
1438
+ )
1439
+ self.get = to_raw_response_wrapper(
1440
+ videos.get,
1441
+ )
1442
+ self.get_parameters_for_direct_upload = to_raw_response_wrapper(
1443
+ videos.get_parameters_for_direct_upload,
1444
+ )
1445
+ self.list_names = to_raw_response_wrapper(
1446
+ videos.list_names,
1447
+ )
1448
+
1449
+ @cached_property
1450
+ def subtitles(self) -> SubtitlesResourceWithRawResponse:
1451
+ return SubtitlesResourceWithRawResponse(self._videos.subtitles)
1452
+
1453
+
1454
+ class AsyncVideosResourceWithRawResponse:
1455
+ def __init__(self, videos: AsyncVideosResource) -> None:
1456
+ self._videos = videos
1457
+
1458
+ self.create = async_to_raw_response_wrapper(
1459
+ videos.create,
1460
+ )
1461
+ self.update = async_to_raw_response_wrapper(
1462
+ videos.update,
1463
+ )
1464
+ self.list = async_to_raw_response_wrapper(
1465
+ videos.list,
1466
+ )
1467
+ self.delete = async_to_raw_response_wrapper(
1468
+ videos.delete,
1469
+ )
1470
+ self.create_multiple = async_to_raw_response_wrapper(
1471
+ videos.create_multiple,
1472
+ )
1473
+ self.get = async_to_raw_response_wrapper(
1474
+ videos.get,
1475
+ )
1476
+ self.get_parameters_for_direct_upload = async_to_raw_response_wrapper(
1477
+ videos.get_parameters_for_direct_upload,
1478
+ )
1479
+ self.list_names = async_to_raw_response_wrapper(
1480
+ videos.list_names,
1481
+ )
1482
+
1483
+ @cached_property
1484
+ def subtitles(self) -> AsyncSubtitlesResourceWithRawResponse:
1485
+ return AsyncSubtitlesResourceWithRawResponse(self._videos.subtitles)
1486
+
1487
+
1488
+ class VideosResourceWithStreamingResponse:
1489
+ def __init__(self, videos: VideosResource) -> None:
1490
+ self._videos = videos
1491
+
1492
+ self.create = to_streamed_response_wrapper(
1493
+ videos.create,
1494
+ )
1495
+ self.update = to_streamed_response_wrapper(
1496
+ videos.update,
1497
+ )
1498
+ self.list = to_streamed_response_wrapper(
1499
+ videos.list,
1500
+ )
1501
+ self.delete = to_streamed_response_wrapper(
1502
+ videos.delete,
1503
+ )
1504
+ self.create_multiple = to_streamed_response_wrapper(
1505
+ videos.create_multiple,
1506
+ )
1507
+ self.get = to_streamed_response_wrapper(
1508
+ videos.get,
1509
+ )
1510
+ self.get_parameters_for_direct_upload = to_streamed_response_wrapper(
1511
+ videos.get_parameters_for_direct_upload,
1512
+ )
1513
+ self.list_names = to_streamed_response_wrapper(
1514
+ videos.list_names,
1515
+ )
1516
+
1517
+ @cached_property
1518
+ def subtitles(self) -> SubtitlesResourceWithStreamingResponse:
1519
+ return SubtitlesResourceWithStreamingResponse(self._videos.subtitles)
1520
+
1521
+
1522
+ class AsyncVideosResourceWithStreamingResponse:
1523
+ def __init__(self, videos: AsyncVideosResource) -> None:
1524
+ self._videos = videos
1525
+
1526
+ self.create = async_to_streamed_response_wrapper(
1527
+ videos.create,
1528
+ )
1529
+ self.update = async_to_streamed_response_wrapper(
1530
+ videos.update,
1531
+ )
1532
+ self.list = async_to_streamed_response_wrapper(
1533
+ videos.list,
1534
+ )
1535
+ self.delete = async_to_streamed_response_wrapper(
1536
+ videos.delete,
1537
+ )
1538
+ self.create_multiple = async_to_streamed_response_wrapper(
1539
+ videos.create_multiple,
1540
+ )
1541
+ self.get = async_to_streamed_response_wrapper(
1542
+ videos.get,
1543
+ )
1544
+ self.get_parameters_for_direct_upload = async_to_streamed_response_wrapper(
1545
+ videos.get_parameters_for_direct_upload,
1546
+ )
1547
+ self.list_names = async_to_streamed_response_wrapper(
1548
+ videos.list_names,
1549
+ )
1550
+
1551
+ @cached_property
1552
+ def subtitles(self) -> AsyncSubtitlesResourceWithStreamingResponse:
1553
+ return AsyncSubtitlesResourceWithStreamingResponse(self._videos.subtitles)