or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

asset-management.mdasset-tracks.mdcontent-delivery-streaming.mdcontent-protection.mdencoding-transforms.mdindex.mdlive-streaming.mdlocation-management.mdmedia-filters.mdmedia-services-management.mdnetwork-security.mdoperations-monitoring.md

content-delivery-streaming.mddocs/

0

# Content Delivery and Streaming

1

2

Comprehensive content delivery capabilities through streaming endpoints, locators, and policies for delivering media content to end users. Supports adaptive bitrate streaming, multiple delivery protocols (HLS, DASH, Smooth Streaming), global CDN distribution, and dynamic packaging with scale-out streaming infrastructure.

3

4

## Capabilities

5

6

### Streaming Endpoint Management

7

8

Manage streaming endpoints that serve as the delivery infrastructure for media content with CDN integration and scaling capabilities.

9

10

```python { .api }

11

def list(resource_group_name: str, account_name: str) -> Iterable[StreamingEndpoint]:

12

"""

13

List all streaming endpoints in a media service account.

14

15

Parameters:

16

- resource_group_name: Name of the resource group (str)

17

- account_name: Name of the media service account (str)

18

19

Returns:

20

Iterable of StreamingEndpoint objects with configuration and status

21

"""

22

23

def get(

24

resource_group_name: str,

25

account_name: str,

26

streaming_endpoint_name: str

27

) -> StreamingEndpoint:

28

"""

29

Get a specific streaming endpoint with complete configuration.

30

31

Parameters:

32

- resource_group_name: Name of the resource group (str)

33

- account_name: Name of the media service account (str)

34

- streaming_endpoint_name: Name of the streaming endpoint (str)

35

36

Returns:

37

StreamingEndpoint object with current state and configuration

38

"""

39

40

def begin_create(

41

resource_group_name: str,

42

account_name: str,

43

streaming_endpoint_name: str,

44

parameters: StreamingEndpoint

45

) -> LROPoller[StreamingEndpoint]:

46

"""

47

Create a new streaming endpoint.

48

49

Parameters:

50

- resource_group_name: Name of the resource group (str)

51

- account_name: Name of the media service account (str)

52

- streaming_endpoint_name: Name for the new streaming endpoint (str)

53

- parameters: Streaming endpoint configuration (StreamingEndpoint)

54

55

Returns:

56

LROPoller for tracking the creation operation

57

"""

58

59

def begin_update(

60

resource_group_name: str,

61

account_name: str,

62

streaming_endpoint_name: str,

63

parameters: StreamingEndpoint

64

) -> LROPoller[StreamingEndpoint]:

65

"""

66

Update an existing streaming endpoint configuration.

67

68

Parameters:

69

- resource_group_name: Name of the resource group (str)

70

- account_name: Name of the media service account (str)

71

- streaming_endpoint_name: Name of the streaming endpoint (str)

72

- parameters: Updated streaming endpoint configuration (StreamingEndpoint)

73

74

Returns:

75

LROPoller for tracking the update operation

76

"""

77

78

def begin_delete(

79

resource_group_name: str,

80

account_name: str,

81

streaming_endpoint_name: str

82

) -> LROPoller[None]:

83

"""

84

Delete a streaming endpoint.

85

86

Parameters:

87

- resource_group_name: Name of the resource group (str)

88

- account_name: Name of the media service account (str)

89

- streaming_endpoint_name: Name of the streaming endpoint (str)

90

91

Returns:

92

LROPoller for tracking the deletion operation

93

"""

94

```

95

96

### Streaming Endpoint Operations

97

98

Control streaming endpoint lifecycle including start, stop, and scaling operations with long-running operation support.

99

100

```python { .api }

101

def begin_start(

102

resource_group_name: str,

103

account_name: str,

104

streaming_endpoint_name: str

105

) -> LROPoller[None]:

106

"""

107

Start a streaming endpoint to begin serving content.

108

109

Parameters:

110

- resource_group_name: Name of the resource group (str)

111

- account_name: Name of the media service account (str)

112

- streaming_endpoint_name: Name of the streaming endpoint (str)

113

114

Returns:

115

LROPoller for tracking the start operation

116

"""

117

118

def begin_stop(

119

resource_group_name: str,

120

account_name: str,

121

streaming_endpoint_name: str

122

) -> LROPoller[None]:

123

"""

124

Stop a streaming endpoint to cease content delivery.

125

126

Parameters:

127

- resource_group_name: Name of the resource group (str)

128

- account_name: Name of the media service account (str)

129

- streaming_endpoint_name: Name of the streaming endpoint (str)

130

131

Returns:

132

LROPoller for tracking the stop operation

133

"""

134

135

def begin_scale(

136

resource_group_name: str,

137

account_name: str,

138

streaming_endpoint_name: str,

139

parameters: StreamingEndpointScaleUnits

140

) -> LROPoller[None]:

141

"""

142

Scale a streaming endpoint to handle increased traffic.

143

144

Parameters:

145

- resource_group_name: Name of the resource group (str)

146

- account_name: Name of the media service account (str)

147

- streaming_endpoint_name: Name of the streaming endpoint (str)

148

- parameters: Scaling configuration (StreamingEndpointScaleUnits)

149

150

Returns:

151

LROPoller for tracking the scaling operation

152

"""

153

```

154

155

### Streaming Endpoint Information

156

157

Retrieve streaming endpoint capabilities and pricing information.

158

159

```python { .api }

160

def skus(

161

resource_group_name: str,

162

account_name: str,

163

streaming_endpoint_name: str

164

) -> StreamingEndpointSkuInfoListResult:

165

"""

166

List available SKUs and pricing tiers for streaming endpoints.

167

168

Parameters:

169

- resource_group_name: Name of the resource group (str)

170

- account_name: Name of the media service account (str)

171

- streaming_endpoint_name: Name of the streaming endpoint (str)

172

173

Returns:

174

StreamingEndpointSkuInfoListResult with available SKU information

175

"""

176

```

177

178

### Streaming Locator Management

179

180

Manage streaming locators that define how assets are published and accessed by end users.

181

182

```python { .api }

183

def list(resource_group_name: str, account_name: str) -> Iterable[StreamingLocator]:

184

"""

185

List all streaming locators in a media service account.

186

187

Parameters:

188

- resource_group_name: Name of the resource group (str)

189

- account_name: Name of the media service account (str)

190

191

Returns:

192

Iterable of StreamingLocator objects with publishing configuration

193

"""

194

195

def get(

196

resource_group_name: str,

197

account_name: str,

198

streaming_locator_name: str

199

) -> StreamingLocator:

200

"""

201

Get a specific streaming locator with complete configuration.

202

203

Parameters:

204

- resource_group_name: Name of the resource group (str)

205

- account_name: Name of the media service account (str)

206

- streaming_locator_name: Name of the streaming locator (str)

207

208

Returns:

209

StreamingLocator object with publishing details

210

"""

211

212

def create(

213

resource_group_name: str,

214

account_name: str,

215

streaming_locator_name: str,

216

parameters: StreamingLocator

217

) -> StreamingLocator:

218

"""

219

Create a streaming locator to publish an asset.

220

221

Parameters:

222

- resource_group_name: Name of the resource group (str)

223

- account_name: Name of the media service account (str)

224

- streaming_locator_name: Name for the new streaming locator (str)

225

- parameters: Streaming locator configuration (StreamingLocator)

226

227

Returns:

228

Created StreamingLocator object

229

"""

230

231

def delete(

232

resource_group_name: str,

233

account_name: str,

234

streaming_locator_name: str

235

) -> None:

236

"""

237

Delete a streaming locator.

238

239

Parameters:

240

- resource_group_name: Name of the resource group (str)

241

- account_name: Name of the media service account (str)

242

- streaming_locator_name: Name of the streaming locator (str)

243

244

Returns:

245

None

246

"""

247

```

248

249

### Streaming URL Generation

250

251

Generate streaming URLs and retrieve content keys for published assets.

252

253

```python { .api }

254

def list_paths(

255

resource_group_name: str,

256

account_name: str,

257

streaming_locator_name: str

258

) -> ListPathsResponse:

259

"""

260

List streaming URLs and download paths for a streaming locator.

261

262

Parameters:

263

- resource_group_name: Name of the resource group (str)

264

- account_name: Name of the media service account (str)

265

- streaming_locator_name: Name of the streaming locator (str)

266

267

Returns:

268

ListPathsResponse containing streaming and download URLs

269

"""

270

271

def list_content_keys(

272

resource_group_name: str,

273

account_name: str,

274

streaming_locator_name: str

275

) -> ListContentKeysResponse:

276

"""

277

List content keys for a streaming locator with encryption.

278

279

Parameters:

280

- resource_group_name: Name of the resource group (str)

281

- account_name: Name of the media service account (str)

282

- streaming_locator_name: Name of the streaming locator (str)

283

284

Returns:

285

ListContentKeysResponse containing content encryption keys

286

"""

287

```

288

289

### Streaming Policy Management

290

291

Manage streaming policies that define delivery protocols and encryption settings.

292

293

```python { .api }

294

def list(resource_group_name: str, account_name: str) -> Iterable[StreamingPolicy]:

295

"""

296

List all streaming policies in a media service account.

297

298

Parameters:

299

- resource_group_name: Name of the resource group (str)

300

- account_name: Name of the media service account (str)

301

302

Returns:

303

Iterable of StreamingPolicy objects with delivery configuration

304

"""

305

306

def get(

307

resource_group_name: str,

308

account_name: str,

309

streaming_policy_name: str

310

) -> StreamingPolicy:

311

"""

312

Get a specific streaming policy with complete configuration.

313

314

Parameters:

315

- resource_group_name: Name of the resource group (str)

316

- account_name: Name of the media service account (str)

317

- streaming_policy_name: Name of the streaming policy (str)

318

319

Returns:

320

StreamingPolicy object with delivery and encryption settings

321

"""

322

323

def create(

324

resource_group_name: str,

325

account_name: str,

326

streaming_policy_name: str,

327

parameters: StreamingPolicy

328

) -> StreamingPolicy:

329

"""

330

Create a streaming policy with delivery and encryption configuration.

331

332

Parameters:

333

- resource_group_name: Name of the resource group (str)

334

- account_name: Name of the media service account (str)

335

- streaming_policy_name: Name for the new streaming policy (str)

336

- parameters: Streaming policy configuration (StreamingPolicy)

337

338

Returns:

339

Created StreamingPolicy object

340

"""

341

342

def delete(

343

resource_group_name: str,

344

account_name: str,

345

streaming_policy_name: str

346

) -> None:

347

"""

348

Delete a streaming policy.

349

350

Parameters:

351

- resource_group_name: Name of the resource group (str)

352

- account_name: Name of the media service account (str)

353

- streaming_policy_name: Name of the streaming policy (str)

354

355

Returns:

356

None

357

"""

358

```

359

360

## Data Types

361

362

```python { .api }

363

class StreamingEndpoint:

364

"""Streaming endpoint for content delivery."""

365

name: str

366

description: str

367

location: str

368

scale_units: int

369

availability_set_name: str

370

access_control: StreamingEndpointAccessControl

371

max_cache_age: int

372

custom_host_names: List[str]

373

host_name: str

374

cdn_enabled: bool

375

cdn_provider: str

376

cdn_profile: str

377

provisioning_state: str

378

resource_state: str # StreamingEndpointResourceState enum

379

cross_site_access_policies: CrossSiteAccessPolicies

380

free_trial_end_time: str

381

created: str

382

last_modified: str

383

384

class StreamingEndpointAccessControl:

385

"""Access control configuration for streaming endpoints."""

386

akamai_signature_header_authentication_key_list: List[AkamaiSignatureHeaderAuthenticationKey]

387

ip: IPAccessControl

388

389

class StreamingEndpointScaleUnits:

390

"""Scaling configuration for streaming endpoints."""

391

scale_unit: int

392

393

class StreamingEndpointSkuInfoListResult:

394

"""Available SKU information for streaming endpoints."""

395

value: List[StreamingEndpointSkuInfo]

396

397

class StreamingEndpointSkuInfo:

398

"""SKU information for streaming endpoints."""

399

resource_type: str

400

sku: StreamingEndpointSku

401

capacity: StreamingEndpointSkuCapacity

402

403

class StreamingLocator:

404

"""Configuration for publishing assets to streaming endpoints."""

405

name: str

406

asset_name: str

407

start_time: str

408

end_time: str

409

streaming_locator_id: str

410

streaming_policy_name: str

411

default_content_key_policy_name: str

412

content_keys: List[StreamingLocatorContentKey]

413

alternative_media_id: str

414

filters: List[str]

415

created: str

416

417

class StreamingLocatorContentKey:

418

"""Content key configuration for streaming locators."""

419

id: str

420

type: str # StreamingLocatorContentKeyType enum

421

label_reference_in_streaming_policy: str

422

value: str

423

policy_name: str

424

tracks: List[TrackSelection]

425

426

class ListPathsResponse:

427

"""Response containing streaming URLs and download paths."""

428

streaming_paths: List[StreamingPath]

429

download_paths: List[str]

430

431

class StreamingPath:

432

"""Streaming path information."""

433

streaming_protocol: str # StreamingPolicyStreamingProtocol enum

434

encryption_scheme: str # EncryptionScheme enum

435

paths: List[str]

436

437

class ListContentKeysResponse:

438

"""Response containing content encryption keys."""

439

content_keys: List[StreamingLocatorContentKey]

440

441

class StreamingPolicy:

442

"""Policy defining streaming delivery protocols and encryption."""

443

name: str

444

default_content_key_policy_name: str

445

envelope_encryption: EnvelopeEncryption

446

common_encryption_cenc: CommonEncryptionCenc

447

common_encryption_cbcs: CommonEncryptionCbcs

448

no_encryption: NoEncryption

449

created: str

450

451

class EnvelopeEncryption:

452

"""Envelope encryption configuration."""

453

enabled_protocols: EnabledProtocols

454

clear_tracks: List[TrackSelection]

455

content_keys: StreamingPolicyContentKeys

456

custom_key_acquisition_url_template: str

457

458

class CommonEncryptionCenc:

459

"""Common encryption CENC configuration."""

460

enabled_protocols: EnabledProtocols

461

clear_tracks: List[TrackSelection]

462

content_keys: StreamingPolicyContentKeys

463

drm: CencDrmConfiguration

464

465

class CommonEncryptionCbcs:

466

"""Common encryption CBCS configuration."""

467

enabled_protocols: EnabledProtocols

468

clear_tracks: List[TrackSelection]

469

content_keys: StreamingPolicyContentKeys

470

drm: CbcsDrmConfiguration

471

472

class NoEncryption:

473

"""Clear streaming configuration without encryption."""

474

enabled_protocols: EnabledProtocols

475

476

class EnabledProtocols:

477

"""Enabled streaming protocols."""

478

download: bool

479

dash: bool

480

hls: bool

481

smooth_streaming: bool

482

```

483

484

## Usage Examples

485

486

### Create and Start Streaming Endpoint

487

488

```python

489

from azure.mgmt.media import AzureMediaServices

490

from azure.mgmt.media.models import StreamingEndpoint, IPAccessControl, IPRange

491

from azure.identity import DefaultAzureCredential

492

493

client = AzureMediaServices(

494

credential=DefaultAzureCredential(),

495

subscription_id="your-subscription-id"

496

)

497

498

# Configure access control (allow all - use restrictive rules in production)

499

ip_range = IPRange(

500

name="AllowAll",

501

address="0.0.0.0",

502

subnet_prefix_length=0

503

)

504

505

access_control = StreamingEndpointAccessControl(

506

ip=IPAccessControl(allow=[ip_range])

507

)

508

509

# Create streaming endpoint

510

streaming_endpoint = StreamingEndpoint(

511

location="East US",

512

description="Primary streaming endpoint for content delivery",

513

scale_units=1,

514

cdn_enabled=True,

515

access_control=access_control,

516

max_cache_age=300

517

)

518

519

# Start creation

520

create_operation = client.streaming_endpoints.begin_create(

521

resource_group_name="my-resource-group",

522

account_name="my-media-service",

523

streaming_endpoint_name="default",

524

parameters=streaming_endpoint

525

)

526

527

created_endpoint = create_operation.result()

528

print(f"Streaming endpoint created: {created_endpoint.name}")

529

530

# Start the streaming endpoint

531

start_operation = client.streaming_endpoints.begin_start(

532

resource_group_name="my-resource-group",

533

account_name="my-media-service",

534

streaming_endpoint_name="default"

535

)

536

537

start_operation.result()

538

print("Streaming endpoint started and ready to serve content")

539

```

540

541

### Create Streaming Locator and Get URLs

542

543

```python

544

from azure.mgmt.media.models import StreamingLocator

545

from datetime import datetime, timedelta

546

547

# Create streaming locator

548

streaming_locator = StreamingLocator(

549

asset_name="encoded-asset",

550

streaming_policy_name="Predefined_ClearStreamingOnly",

551

start_time=datetime.utcnow().isoformat() + "Z",

552

end_time=(datetime.utcnow() + timedelta(days=365)).isoformat() + "Z"

553

)

554

555

created_locator = client.streaming_locators.create(

556

resource_group_name="my-resource-group",

557

account_name="my-media-service",

558

streaming_locator_name="clear-streaming-locator",

559

parameters=streaming_locator

560

)

561

562

print(f"Streaming locator created: {created_locator.name}")

563

564

# Get streaming URLs

565

paths_response = client.streaming_locators.list_paths(

566

resource_group_name="my-resource-group",

567

account_name="my-media-service",

568

streaming_locator_name="clear-streaming-locator"

569

)

570

571

# Get streaming endpoint hostname

572

streaming_endpoint = client.streaming_endpoints.get(

573

resource_group_name="my-resource-group",

574

account_name="my-media-service",

575

streaming_endpoint_name="default"

576

)

577

578

base_url = f"https://{streaming_endpoint.host_name}"

579

580

print("Streaming URLs:")

581

for streaming_path in paths_response.streaming_paths:

582

protocol = streaming_path.streaming_protocol

583

print(f"\n{protocol} URLs:")

584

for path in streaming_path.paths:

585

full_url = f"{base_url}{path}"

586

print(f" {full_url}")

587

588

if paths_response.download_paths:

589

print("\nDownload URLs:")

590

for path in paths_response.download_paths:

591

full_url = f"{base_url}{path}"

592

print(f" {full_url}")

593

```

594

595

### Create Custom Streaming Policy

596

597

```python

598

from azure.mgmt.media.models import (

599

StreamingPolicy, NoEncryption, EnabledProtocols

600

)

601

602

# Configure clear streaming policy

603

enabled_protocols = EnabledProtocols(

604

download=False,

605

dash=True,

606

hls=True,

607

smooth_streaming=True

608

)

609

610

no_encryption = NoEncryption(

611

enabled_protocols=enabled_protocols

612

)

613

614

# Create streaming policy

615

streaming_policy = StreamingPolicy(

616

no_encryption=no_encryption

617

)

618

619

created_policy = client.streaming_policies.create(

620

resource_group_name="my-resource-group",

621

account_name="my-media-service",

622

streaming_policy_name="custom-clear-policy",

623

parameters=streaming_policy

624

)

625

626

print(f"Streaming policy created: {created_policy.name}")

627

```

628

629

### Scale Streaming Endpoint

630

631

```python

632

from azure.mgmt.media.models import StreamingEndpointScaleUnits

633

634

# Check current streaming endpoint status

635

endpoint = client.streaming_endpoints.get(

636

resource_group_name="my-resource-group",

637

account_name="my-media-service",

638

streaming_endpoint_name="default"

639

)

640

641

print(f"Current scale units: {endpoint.scale_units}")

642

print(f"Current state: {endpoint.resource_state}")

643

644

# Scale up to handle more traffic

645

scale_params = StreamingEndpointScaleUnits(scale_unit=3)

646

647

scale_operation = client.streaming_endpoints.begin_scale(

648

resource_group_name="my-resource-group",

649

account_name="my-media-service",

650

streaming_endpoint_name="default",

651

parameters=scale_params

652

)

653

654

scale_operation.result()

655

print("Streaming endpoint scaled to 3 units")

656

657

# Verify scaling

658

scaled_endpoint = client.streaming_endpoints.get(

659

resource_group_name="my-resource-group",

660

account_name="my-media-service",

661

streaming_endpoint_name="default"

662

)

663

664

print(f"New scale units: {scaled_endpoint.scale_units}")

665

```