edit-icon download-icon

AddMediaWorkflow

最終更新日: Mar 19, 2018

Description

The AddMediaWorkflow API adds a media workflow and defines the topology of the media workflow.

Request parameters

Parameter Type Required or not Description
Action String Yes API of the action, system required parameter. Set this parameter to AddMediaWorkflow.
Name String Yes Media workflow name, which consists of up to 64 bytes. It must be UTF-8 encoded and cannot be a null string. The name must be unique.
Topology String Yes Topology of the media workflow, which is a JSON object. The topology includes the activity list and activity dependencies, as shown in the following topology example.

Topology example

{
  "Activities": {
    "Act-Transcode-M3U8": {
      "Parameters": {
        "Outputs": [
          {
            "OutputObject": "transcode%2F%7BObjectPrefix%7D%7BFileName%7D",
            "TemplateId": "957d1719ee85ed6527b90cf62726cbef"
          }
        ],
        "OutputBucket": "panda-vod-hls",
        "OutputLocation": "oss-cn-hangzhou"
      },
      "Type": "Transcode"
    },
    "Act-Start": {
      "Name": "Act-Start",
      "Parameters": {
        "PipelineId": "130266f58161436a80bf07cb12c8009a",
        "InputFile": {
          "Bucket": "panda-vod",
          "Location": "oss-cn-hangzhou"
        }
      },
      "Type": "Start"
    },
    "Act-Report": {
      "Name": "Act-Report",
      "Parameters": {
      },
      "Type": "Report"
    }
  },
  "Dependencies": {
    "Act-Transcode-M3U8": [
      "Act-Report"
    ],
    "Act-Start": [
      "Act-Transcode-M3U8"
    ],
    "Act-Report": [
    ]
  }
}

Start activity

Sets the workspace of the media workflow, global configurations, and parameters supported by the Start activity. Matching rules for workflow triggering.

Parameter Type Required or not Description
InputFile String Yes Input position, for example, {"Bucket": "example-001","Location": "oss-cn-hangzhou", "ObjectPrefix": "test/"}
PipelineId String Yes ID of the MPS queue, which is global. In the workflow scenario, the message configuration for the MPS queue is invalid, but the message configuration of the QueueName and TopicName is valid.
MessageType String No Message category, which has the following options: Queue and Topic. The default value is Queue.
QueueName String No Name of the Message Service queue, which is global.
TopicName String No Topic name, which is global.
RoleName String No Authorization role name, which is global. The default value is AliyunMTSDefaultRole.

Parameters supported by the Transcode activity.

Parameter Type Required or not Description
Outputs String Yes For details, see Output details. For example, [{"OutputObject":"transcode%2F%7BObjectPrefix%7D%2F%7BFileName%7D.%7BExtName%7D","TemplateId": "S00000001-000070"}].
OutputBucket String Yes Output bucket.
OutputLocation String No Output region.

Parameters supported by the Screenshot activity.

Parameter Type Required or not Description
SnapshotConfig String Yes For details, see Details about screenshot parameter configurations. For example, {"OutputFile": {"Bucket": "example-001", "Location": "oss-cn-hangzhou", "Object":"screenshot%2F%7BObjectPrefix%7D%2F%7BFileName%7D.%7BExtName%7D%2F1.jpg"},"Time": "5"}.
MediaCover String No Whether to set the screenshot as the media cover, which has the following options: true and false. The default value is false. This parameter applies only to a single screenshot.

Parameters supported by the Analysis activity.

Parameter Type Required or not Description
KeepOnlyHighestDefinition String No Whether to keep only the highest definition analysis results,defalut value is False,options:True,False

Parameters supported by the Report activity.

Parameter Type Required or not Description
PublishType String No Media publishing type, which has the following options: Auto, Manual, and TranscodeCompletedAuto. Auto indicates that the media set is automatically published after the workflow is executed. Manual indicates that the media set is not published. TranscodeCompletedAuto indicates that the media set is automatically published after any Transcode activity is completed (use the message configuration of the Start node to notify users of transcoding completion and use the Play Service to play the activity output). The default value is Manual.

Return parameters

Name Type Description
MediaWorkflow MediaWorkflow Media workflow

Example

Request example

https://mts.cn-hangzhou.aliyuncs.com/?Name=mediaworkflow-test&Action=AddMediaWorkflow&Topology=%7B%22Activities%22%3A%7B%22Act-Start%22%3A%7B%22Parameters%22%3A%7B%22PipelineId%22%3A%22130266f58161436a80bf07cb12c8009a%22%2C%22InputFile%22%3A%22%7B%5C%22Bucket%5C%22%3A+%5C%22panda-vod%5C%22%2C%5C%22Location%5C%22%3A+%5C%22oss-cn-hangzhou%5C%22%7D%22%7D%2C%22Type%22%3A%22Start%22%7D%2C%22Act-Report%22%3A%7B%22Parameters%22%3A%7B%7D%2C%22Type%22%3A%22Report%22%7D%2C%22Act-Transcode-M3U8%22%3A%7B%22Parameters%22%3A%7B%22Outputs%22%3A%22%5B%7B%5C%22OutputObject%5C%22%3A%5C%22transcode%252F%257BObjectPrefix%257D%257BFileName%257D%5C%22%2C%5C%22TemplateId%5C%22%3A+%5C%22957d1719ee85ed6527b90cf62726cbef%5C%22%7D%5D%22%2C%22OutputBucket%22%3A%22panda-vod-hls%22%2C%22OutputLocation%22%3A%22oss-cn-hangzhou%22%7D%2C%22Type%22%3A%22Transcode%22%7D%7D%2C%22Dependencies%22%3A%7B%22Act-Start%22%3A%5B%22Act-Transcode-M3U8%22%5D%2C%22Act-Report%22%3A%5B%5D%2C%22Act-Transcode-M3U8%22%3A%5B%22Act-Report%22%5D%7D%7D&<Public parameter>

Return example

XML

    <AddMediaWorkflowResponse> 
      <RequestId>F1D21261-ADB9-406A-BF6F-491382139D59</RequestId>  
      <MediaWorkflow> 
        <CreationTime>2016-04-01T05:29:37Z</CreationTime>  
        <Name>mediaworkflow-test</Name>  
        <State>Inactive</State>  
        <Topology>{"Activities":{"Act-Start":{"Parameters":{"PipelineId":"130266f58161436a80bf07cb12c8009a","InputFile":"{\"Bucket\": \"panda-vod\",\"Location\": \"oss-cn-hangzhou\"}"},"Type":"Start"},"Act-Report":{"Parameters":{},"Type":"Report"},"Act-Transcode-M3U8":{"Parameters":{"Outputs":"[{\"OutputObject\":\"transcode%2F%7BObjectPrefix%7D%7BFileName%7D\",\"TemplateId\": \"957d1719ee85ed6527b90cf62726cbef\"}]","OutputBucket":"panda-vod-hls","OutputLocation":"oss-cn-hangzhou"},"Type":"Transcode"}},"Dependencies":{"Act-Start":["Act-Transcode-M3U8"],"Act-Report":[],"Act-Transcode-M3U8":["Act-Report"]}}</Topology>  
        <MediaWorkflowId>e00732b977da427d9177a4dee646b1aa</MediaWorkflowId> 
      </MediaWorkflow> 
    </AddMediaWorkflowResponse>

JSON

    {
        "RequestId": "F1D21261-ADB9-406A-BF6F-491382139D59",
        "MediaWorkflow": {
            "CreationTime": "2016-04-01T05:29:37Z",
            "Name": "mediaworkflow-test",
            "State": "Inactive",
            "Topology": "{\"Activities\":{\"Act-Start\":{\"Parameters\":{\"PipelineId\":\"130266f58161436a80bf07cb12c8009a\",\"InputFile\":\"{\\\"Bucket\\\": \\\"panda-vod\\\",\\\"Location\\\": \\\"oss-cn-hangzhou\\\"}\"},\"Type\":\"Start\"},\"Act-Report\":{\"Parameters\":{},\"Type\":\"Report\"},\"Act-Transcode-M3U8\":{\"Parameters\":{\"Outputs\":\"[{\\\"OutputObject\\\":\\\"transcode%2F%7BObjectPrefix%7D%7BFileName%7D\\\",\\\"TemplateId\\\": \\\"957d1719ee85ed6527b90cf62726cbef\\\"}]\",\"OutputBucket\":\"panda-vod-hls\",\"OutputLocation\":\"oss-cn-hangzhou\"},\"Type\":\"Transcode\"}},\"Dependencies\":{\"Act-Start\":[\"Act-Transcode-M3U8\"],\"Act-Report\":[],\"Act-Transcode-M3U8\":[\"Act-Report\"]}}",
            "MediaWorkflowId": "93ab850b4f6f44eab54b6e91d24d81d4"
        }
    }