CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-media

Microsoft Azure Media Services Client Library for Python - A management library for Azure Media Services that provides programmatic access to media processing and streaming capabilities in the cloud.

83

1.09x

Quality

Pending

Does it follow best practices?

Impact

83%

1.09x

Average score across 10 eval scenarios

Overview
Eval results
Files

task.mdevals/scenario-5/

Video Streaming Publisher

A utility that publishes encoded video assets for streaming delivery to end-users using cloud media services.

Overview

You need to implement a video streaming publisher that takes encoded video assets and makes them available for streaming to viewers. The system should support multiple streaming protocols, manage streaming infrastructure, and generate playback URLs.

Requirements

Asset Publishing

The system must be able to publish video assets for streaming delivery by creating appropriate publishing configurations. Assets should be made available through a unique identifier.

Streaming Infrastructure Management

The system must manage streaming infrastructure including:

  • Starting and stopping streaming servers
  • Scaling streaming capacity to handle different load levels
  • Retrieving the hostname of active streaming servers

URL Generation

The system must generate playback URLs for published assets. URLs should support multiple streaming protocols including:

  • HLS (HTTP Live Streaming)
  • DASH (Dynamic Adaptive Streaming over HTTP)
  • Smooth Streaming

Streaming Policy Configuration

When publishing assets, the system should support different streaming policies that control how content is packaged and delivered. At minimum, support for a default clear streaming policy should be included.

Implementation

@generates

API

class StreamingPublisher:
    """Manages video asset publishing and streaming delivery."""

    def __init__(self, client, resource_group: str, account_name: str):
        """
        Initialize the publisher.

        Args:
            client: Azure Media Services client
            resource_group: Azure resource group name
            account_name: Media Services account name
        """
        pass

    def publish_asset(self, asset_name: str, locator_name: str, streaming_policy: str = "Predefined_ClearStreamingOnly") -> dict:
        """
        Publish an asset for streaming by creating a streaming locator.

        Args:
            asset_name: Name of the asset to publish
            locator_name: Unique name for the streaming locator
            streaming_policy: Name of the streaming policy to use

        Returns:
            Dictionary containing locator information
        """
        pass

    def start_streaming_endpoint(self, endpoint_name: str) -> None:
        """
        Start a streaming endpoint to enable content delivery.

        Args:
            endpoint_name: Name of the streaming endpoint to start
        """
        pass

    def stop_streaming_endpoint(self, endpoint_name: str) -> None:
        """
        Stop a streaming endpoint.

        Args:
            endpoint_name: Name of the streaming endpoint to stop
        """
        pass

    def scale_streaming_endpoint(self, endpoint_name: str, scale_units: int) -> None:
        """
        Scale a streaming endpoint to handle more concurrent viewers.

        Args:
            endpoint_name: Name of the streaming endpoint
            scale_units: Number of scale units (0 for standard, >0 for premium)
        """
        pass

    def get_streaming_urls(self, locator_name: str, endpoint_name: str) -> dict:
        """
        Generate streaming URLs for a published asset.

        Args:
            locator_name: Name of the streaming locator
            endpoint_name: Name of the streaming endpoint

        Returns:
            Dictionary with protocol names as keys and URLs as values
            Example: {"HLS": "https://...", "DASH": "https://...", "SmoothStreaming": "https://..."}
        """
        pass

    def get_endpoint_hostname(self, endpoint_name: str) -> str:
        """
        Get the hostname of a streaming endpoint.

        Args:
            endpoint_name: Name of the streaming endpoint

        Returns:
            Hostname string
        """
        pass

Test Cases

Publish Asset

  • Given an encoded asset named "test-asset", when publishing with locator name "test-locator", then a streaming locator is created successfully @test

Start Streaming Endpoint

  • Given a stopped streaming endpoint named "default", when starting it, then the endpoint state becomes "Running" @test

Generate Streaming URLs

  • Given a published asset with locator "test-locator" and endpoint "default", when generating streaming URLs, then URLs are returned for HLS, DASH, and Smooth Streaming protocols @test

Scale Streaming Endpoint

  • Given a streaming endpoint named "default", when scaling to 2 units, then the endpoint scale units property is updated to 2 @test

Dependencies { .dependencies }

azure-mgmt-media { .dependency }

Provides Azure Media Services management capabilities for publishing and streaming video content.

Install with Tessl CLI

npx tessl i tessl/pypi-azure-mgmt-media

tile.json