0
# Channel Management
1
2
Complete channel lifecycle management for live streaming operations including creation, configuration, starting/stopping, and deletion of live streaming channels with support for multiple output formats and quality levels.
3
4
## Capabilities
5
6
### Creating Channels
7
8
Creates a new live streaming channel with input attachments, output configurations, and optional features like encryption, timecode, and sprite sheets.
9
10
```python { .api }
11
def create_channel(
12
self,
13
request: Union[CreateChannelRequest, dict] = None,
14
*,
15
parent: str = None,
16
channel: Channel = None,
17
channel_id: str = None,
18
retry: OptionalRetry = gapic_v1.method.DEFAULT,
19
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
21
) -> operation.Operation:
22
"""
23
Creates a channel with the provided unique ID in the specified region.
24
25
Args:
26
request: The request object containing parent, channel_id, channel, and request_id
27
parent: Required. The parent location path (projects/{project}/locations/{location})
28
channel: Required. The channel resource to create
29
channel_id: Required. The ID to use for the channel (must be unique within parent)
30
retry: Retry configuration for the request
31
timeout: Request timeout in seconds
32
metadata: Additional metadata for the request
33
34
Returns:
35
google.api_core.operation.Operation: Long-running operation
36
37
Raises:
38
google.api_core.exceptions.GoogleAPICallError: If the request fails
39
"""
40
```
41
42
### Listing Channels
43
44
Retrieves a list of channels with optional filtering, pagination, and sorting capabilities.
45
46
```python { .api }
47
def list_channels(
48
self,
49
request: Union[ListChannelsRequest, dict] = None,
50
*,
51
parent: str = None,
52
retry: OptionalRetry = gapic_v1.method.DEFAULT,
53
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
54
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
55
) -> pagers.ListChannelsPager:
56
"""
57
Returns a list of all channels in the specified region.
58
59
Args:
60
request: The request object containing parent, page_size, page_token, filter, order_by
61
parent: Required. The parent path (projects/{project}/locations/{location})
62
retry: Retry configuration for the request
63
timeout: Request timeout in seconds
64
metadata: Additional metadata for the request
65
66
Returns:
67
pagers.ListChannelsPager: Pager for iterating over channel results
68
69
Raises:
70
google.api_core.exceptions.GoogleAPICallError: If the request fails
71
"""
72
```
73
74
### Getting Channel Details
75
76
Retrieves detailed information about a specific channel including its current state, configuration, and streaming status.
77
78
```python { .api }
79
def get_channel(
80
self,
81
request: Union[GetChannelRequest, dict] = None,
82
*,
83
name: str = None,
84
retry: OptionalRetry = gapic_v1.method.DEFAULT,
85
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
86
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
87
) -> Channel:
88
"""
89
Returns the specified channel.
90
91
Args:
92
request: The request object containing name
93
name: Required. The channel name (projects/{project}/locations/{location}/channels/{channel})
94
retry: Retry configuration for the request
95
timeout: Request timeout in seconds
96
metadata: Additional metadata for the request
97
98
Returns:
99
Channel: The channel resource
100
101
Raises:
102
google.api_core.exceptions.GoogleAPICallError: If the request fails
103
"""
104
```
105
106
### Updating Channels
107
108
Updates channel configuration including input attachments, output settings, and other properties while preserving channel state.
109
110
```python { .api }
111
def update_channel(
112
self,
113
request: Union[UpdateChannelRequest, dict] = None,
114
*,
115
channel: Channel = None,
116
update_mask: field_mask_pb2.FieldMask = None,
117
retry: OptionalRetry = gapic_v1.method.DEFAULT,
118
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
119
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
120
) -> operation.Operation:
121
"""
122
Updates the specified channel.
123
124
Args:
125
request: The request object containing update_mask, channel, and request_id
126
channel: Required. The channel resource with updated fields
127
update_mask: Required. Field mask specifying which fields to update
128
retry: Retry configuration for the request
129
timeout: Request timeout in seconds
130
metadata: Additional metadata for the request
131
132
Returns:
133
google.api_core.operation.Operation: Long-running operation
134
135
Raises:
136
google.api_core.exceptions.GoogleAPICallError: If the request fails
137
"""
138
```
139
140
### Starting Channels
141
142
Starts a live streaming channel, initiating the transcoding pipeline and making the channel ready to receive input streams.
143
144
```python { .api }
145
def start_channel(
146
self,
147
request: Union[StartChannelRequest, dict] = None,
148
*,
149
name: str = None,
150
retry: OptionalRetry = gapic_v1.method.DEFAULT,
151
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
152
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
153
) -> operation.Operation:
154
"""
155
Starts the specified channel.
156
157
Args:
158
request: The request object containing name and request_id
159
name: Required. The channel name (projects/{project}/locations/{location}/channels/{channel})
160
retry: Retry configuration for the request
161
timeout: Request timeout in seconds
162
metadata: Additional metadata for the request
163
164
Returns:
165
google.api_core.operation.Operation: Long-running operation
166
167
Raises:
168
google.api_core.exceptions.GoogleAPICallError: If the request fails
169
"""
170
```
171
172
### Stopping Channels
173
174
Stops an active streaming channel, halting the transcoding pipeline and input processing while preserving channel configuration.
175
176
```python { .api }
177
def stop_channel(
178
self,
179
request: Union[StopChannelRequest, dict] = None,
180
*,
181
name: str = None,
182
retry: OptionalRetry = gapic_v1.method.DEFAULT,
183
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
184
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
185
) -> operation.Operation:
186
"""
187
Stops the specified channel.
188
189
Args:
190
request: The request object containing name and request_id
191
name: Required. The channel name (projects/{project}/locations/{location}/channels/{channel})
192
retry: Retry configuration for the request
193
timeout: Request timeout in seconds
194
metadata: Additional metadata for the request
195
196
Returns:
197
google.api_core.operation.Operation: Long-running operation
198
199
Raises:
200
google.api_core.exceptions.GoogleAPICallError: If the request fails
201
"""
202
```
203
204
### Deleting Channels
205
206
Permanently removes a channel and all associated resources including output manifests and stream data.
207
208
```python { .api }
209
def delete_channel(
210
self,
211
request: Union[DeleteChannelRequest, dict] = None,
212
*,
213
name: str = None,
214
retry: OptionalRetry = gapic_v1.method.DEFAULT,
215
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
216
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
217
) -> operation.Operation:
218
"""
219
Deletes the specified channel.
220
221
Args:
222
request: The request object containing name and request_id
223
name: Required. The channel name (projects/{project}/locations/{location}/channels/{channel})
224
retry: Retry configuration for the request
225
timeout: Request timeout in seconds
226
metadata: Additional metadata for the request
227
228
Returns:
229
google.api_core.operation.Operation: Long-running operation
230
231
Raises:
232
google.api_core.exceptions.GoogleAPICallError: If the request fails
233
"""
234
```
235
236
## Channel Configuration Types
237
238
### Channel Resource
239
240
```python { .api }
241
class Channel:
242
"""
243
Channel resource represents a live streaming channel configuration.
244
245
Attributes:
246
name (str): Channel resource name
247
create_time (google.protobuf.timestamp_pb2.Timestamp): Creation timestamp
248
update_time (google.protobuf.timestamp_pb2.Timestamp): Last update timestamp
249
labels (MutableMapping[str, str]): User-defined labels
250
input_attachments (MutableSequence[InputAttachment]): Attached input sources
251
active_input (str): Currently active input key
252
output (ElementaryStream): Primary output stream configuration
253
elementary_streams (MutableSequence[ElementaryStream]): All elementary streams
254
mux_streams (MutableSequence[MuxStream]): Multiplexed stream configurations
255
manifests (MutableSequence[Manifest]): Output manifest configurations
256
sprite_sheets (MutableSequence[SpriteSheet]): Sprite sheet configurations
257
streaming_state (StreamingState): Current streaming state
258
streaming_error (google.rpc.status_pb2.Status): Any streaming errors
259
log_config (LogConfig): Logging configuration
260
timecode_config (TimecodeConfig): Timecode handling configuration
261
encryptions (MutableSequence[Encryption]): Encryption configurations
262
"""
263
264
class StreamingState(proto.Enum):
265
"""Channel streaming state enumeration."""
266
STREAMING_STATE_UNSPECIFIED = 0
267
STREAMING = 1
268
AWAITING_INPUT = 2
269
STREAMING_ERROR = 3
270
STREAMING_NO_INPUT = 4
271
STOPPED = 5
272
STARTING = 6
273
STOPPING = 7
274
```
275
276
### Input Attachment
277
278
```python { .api }
279
class InputAttachment:
280
"""
281
Input attachment links an input to a channel.
282
283
Attributes:
284
key (str): Unique identifier for this attachment within the channel
285
input (str): Input resource name to attach
286
automatic_failover (AutomaticFailover): Failover configuration
287
"""
288
289
class AutomaticFailover:
290
"""Automatic failover configuration for input attachments."""
291
input_keys (MutableSequence[str]): Ordered list of input keys for failover
292
```
293
294
## Usage Examples
295
296
### Basic Channel Creation
297
298
```python
299
from google.cloud.video import live_stream_v1
300
301
client = live_stream_v1.LivestreamServiceClient()
302
303
# Create channel with single input attachment
304
channel = live_stream_v1.Channel(
305
input_attachments=[
306
live_stream_v1.InputAttachment(
307
key="input1",
308
input="projects/my-project/locations/us-central1/inputs/my-input"
309
)
310
],
311
output=live_stream_v1.outputs.ElementaryStream(
312
video_stream=live_stream_v1.outputs.VideoStream(
313
h264=live_stream_v1.outputs.VideoStream.H264CodecSettings(
314
bitrate_bps=2000000,
315
frame_rate=30,
316
height_pixels=720,
317
width_pixels=1280
318
)
319
),
320
audio_stream=live_stream_v1.outputs.AudioStream(
321
codec="aac",
322
bitrate_bps=128000,
323
channel_count=2,
324
channel_layout=["fl", "fr"],
325
sample_rate_hertz=48000
326
)
327
)
328
)
329
330
request = live_stream_v1.CreateChannelRequest(
331
parent="projects/my-project/locations/us-central1",
332
channel_id="my-live-channel",
333
channel=channel
334
)
335
336
operation = client.create_channel(request=request)
337
channel_resource = operation.result()
338
print(f"Created channel: {channel_resource.name}")
339
```
340
341
### Channel with Multiple Outputs
342
343
```python
344
# Create channel with HLS and DASH manifests
345
channel = live_stream_v1.Channel(
346
input_attachments=[
347
live_stream_v1.InputAttachment(
348
key="primary",
349
input="projects/my-project/locations/us-central1/inputs/input-1"
350
)
351
],
352
elementary_streams=[
353
live_stream_v1.outputs.ElementaryStream(
354
key="video-720p",
355
video_stream=live_stream_v1.outputs.VideoStream(
356
h264=live_stream_v1.outputs.VideoStream.H264CodecSettings(
357
bitrate_bps=2000000,
358
frame_rate=30,
359
height_pixels=720,
360
width_pixels=1280
361
)
362
)
363
),
364
live_stream_v1.outputs.ElementaryStream(
365
key="audio-128k",
366
audio_stream=live_stream_v1.outputs.AudioStream(
367
codec="aac",
368
bitrate_bps=128000,
369
channel_count=2,
370
sample_rate_hertz=48000
371
)
372
)
373
],
374
mux_streams=[
375
live_stream_v1.outputs.MuxStream(
376
key="mux-720p",
377
elementary_streams=["video-720p", "audio-128k"],
378
segment_settings=live_stream_v1.outputs.SegmentSettings(
379
segment_duration=duration_pb2.Duration(seconds=4)
380
)
381
)
382
],
383
manifests=[
384
live_stream_v1.outputs.Manifest(
385
file_name="manifest.m3u8",
386
type_=live_stream_v1.outputs.Manifest.ManifestType.HLS,
387
mux_streams=["mux-720p"]
388
),
389
live_stream_v1.outputs.Manifest(
390
file_name="manifest.mpd",
391
type_=live_stream_v1.outputs.Manifest.ManifestType.DASH,
392
mux_streams=["mux-720p"]
393
)
394
]
395
)
396
```