从 HTTPS URL 创建作业输入Create a job input from an HTTPS URL

在媒体服务 v3 中提交作业来处理视频时,必须告知媒体服务查找输入视频的位置。In Media Services v3, when you submit Jobs to process your videos, you have to tell Media Services where to find the input video. 其中一个选项是指定 HTTPS URL 作为作业输入(如本示例所示)。One of the options is to specify an HTTPS URL as a job input (as shown in this example). 请注意,目前,AMS v3 不支持基于 HTTPS URL 的块传输编码。Note that currently, AMS v3 does not support chunked transfer encoding over HTTPS URLs. 有关完整示例,请参阅此 GitHub 示例For a full example, see this GitHub sample.

提示

在开始开发之前,请查看使用媒体服务 v3 API 进行开发(包括有关访问 API、命名约定等的信息)Before you start developing, review Developing with Media Services v3 APIs (includes information on accessing APIs, naming conventions, etc.)

.NET 示例.NET sample

以下代码说明了如何使用 HTTPS URL 输入创建作业。The following code shows how to create a job with an HTTPS URL input.

private static async Task<Job> SubmitJobAsync(IAzureMediaServicesClient client,
    string resourceGroup,
    string accountName,
    string transformName,
    string outputAssetName,
    string jobName)
{
    // This example shows how to encode from any HTTPs source URL - a new feature of the v3 API.  
    // Change the URL to any accessible HTTPs URL or SAS URL from Azure.
    JobInputHttp jobInput =
        new JobInputHttp(files: new[] { "https://nimbuscdn-nimbuspm.streaming.mediaservices.windows.net/2b533311-b215-4409-80af-529c3e853622/Ignite-short.mp4" });

    JobOutput[] jobOutputs =
    {
        new JobOutputAsset(outputAssetName),
    };

    // In this example, we are assuming that the job name is unique.
    //
    // If you already have a job with the desired name, use the Jobs.Get method
    // to get the existing job. In Media Services v3, Get methods on entities returns null 
    // if the entity doesn't exist (a case-insensitive check on the name).
    Job job = await client.Jobs.CreateAsync(
        resourceGroup,
        accountName,
        transformName,
        jobName,
        new Job
        {
            Input = jobInput,
            Outputs = jobOutputs,
        });

    return job;
}

作业错误代码Job error codes

请参阅错误代码See Error codes.

后续步骤Next steps

从本地文件创建作业输入Create a job input from a local file.