ALIYUN::ICE::UploadMedia

ALIYUN::ICE::UploadMedia类型用于获取媒资上传地址和凭证。

语法

{
  "Type": "ALIYUN::ICE::UploadMedia",
  "Properties": {
    "AppId": String,
    "EntityId": String,
    "FileInfo": Map,
    "MediaMetaData": Map,
    "PostProcessConfig": Map,
    "UserData": Map,
    "UploadTargetConfig": Map
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

AppId

String

应用 ID。

EntityId

String

实体 ID。

FileInfo

Map

文件信息。

包含参数字段:

  • Type(必填):文件类型,取值 video、image、audio、text、other。

  • Name(必填):文件名,不带扩展名。

  • Size(选填):文件大小。

  • Ext(必填):文件扩展名。

MediaMetaData

Map

上传媒资的元数据。

包含参数字段:

Title 标题(必填):

  • 长度不超过 128 个字符。

  • UTF-8 编码。

Description 描述(选填):

  • 长度不超过 1024 个字符。

  • UTF-8 编码。

CateId 分类 ID(选填)。

Tags 标签(选填)。

BusinessType 业务类型(必填),取值:

  • Type = video ,取值: opening: 片头/开场;ending: 片尾

  • Type = image ,取值: default:默认; cover:封面

  • Type = text ,取值: subtitles:字幕; font:字体;

  • Type=material ,取值: watermark:水印;

  • general 通用; CoverURL 封面(选填)。

DynamicMetaData 动态元数据,类型为字符串。

PostProcessConfig

Map

上传后的处理动作。

UserData

Map

自定义设置。

UploadTargetConfig

Map

目标存储地址。

包含参数字段:

  • StorageType 取值:仅支持 oss。

  • StorageLocation 仅支持 VOD 点播存储,不支持用户自有 OSS 存储。

返回值

Fn::GetAtt

  • FileURL:文件 OSS 地址

  • MediaURL:媒资地址。

  • UploadAddress:上传地址。

  • MediaId:媒资 ID。

  • UploadAuth:上传凭证。

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  EntityId:
    Type: String
    Description:
      en: The entity ID. You can call the CreateEntity operation to create an entity and specify a dynamic metadata structure.
    Required: false
  AppId:
    Type: String
    Description:
      en: 'The application ID. Default value: app-1000000.'
    Required: false
  FileInfo:
    Type: Json
    Description:
      en: |-
        The file information, which is in the JSON format and contains the following fields:
        Type: required. The file type. Valid values: video, image, audio, text, and other.
        Name: required. The file name without the extension.
        Size: optional. The file size.
        Ext: required. The file name extension.
    Required: false
  UserData:
    Type: Json
    Description:
      en: The user data. The value must be a JSON string. You can configure settings such as message callbacks.
    Required: false
  UploadTargetConfig:
    Type: Json
    Description:
      en: |-
        The destination storage address.
        Set StorageType to oss.
        Set StorageLocation to an address in ApsaraVideo VOD. You cannot set this field to an OSS URL.
    Required: false
  MediaMetaData:
    Type: Json
    Description:
      en: |-
        The metadata of the media asset, which is a JSON string that contains the following fields:
        Title: required.
        The value can be up to 128 characters in length.
        The value must be encoded in UTF-8.
        Description: optional.
        The value can be up to 1,024 characters in length.
        The value must be encoded in UTF-8.
        CateId: optional.
        Tags: optional.
        BusinessType: required. Valid values:
        opening or ending if Type is set to video
        default or cover if Type is set to image
        subtitles or font if Type is set to text
        watermark if Type is set to material
        general CoverURL: optional.
        DynamicMetaData: The value is a string.
    Required: false
  PostProcessConfig:
    Type: Json
    Description:
      en: 'Type = video || audio There is a post-upload processing action. ProcessType Value: Workflow.'
    Required: false
Resources:
  UploadMedia:
    Type: ALIYUN::ICE::UploadMedia
    Properties:
      EntityId:
        Ref: EntityId
      AppId:
        Ref: AppId
      FileInfo:
        Ref: FileInfo
      UserData:
        Ref: UserData
      UploadTargetConfig:
        Ref: UploadTargetConfig
      MediaMetaData:
        Ref: MediaMetaData
      PostProcessConfig:
        Ref: PostProcessConfig
Outputs:
  FileURL:
    Description: The OSS URL of the file. The URL does not contain the information used for authentication.
    Value:
      Fn::GetAtt:
        - UploadMedia
        - FileURL
  MediaURL:
    Description: |-
      The URL of the media asset.
      Note If a domain name for Alibaba Cloud CDN (CDN) is specified, a CDN URL is returned. Otherwise, an OSS URL is returned. If the HTTP status code 403 is returned when you access the URL from your browser, the URL authentication feature of ApsaraVideo VOD is enabled. To resolve this issue, disable URL authentication or generate an authentication signature.
    Value:
      Fn::GetAtt:
        - UploadMedia
        - MediaURL
  UploadAddress:
    Description: |-
      The upload URL.
      Note The returned upload URL is a Base64-encoded URL. You must decode the Base64-encoded upload URL before you use an SDK or call an API operation to upload media files. You need to parse UploadAddress only if you use OSS SDK or call an OSS API operation to upload media files.
    Value:
      Fn::GetAtt:
        - UploadMedia
        - UploadAddress
  MediaId:
    Description: The ID of the media asset.
    Value:
      Fn::GetAtt:
        - UploadMedia
        - MediaId
  UploadAuth:
    Description: |-
      The upload credential.
      Note The returned upload credential is a Base64-encoded value. You must decode the Base64-encoded upload URL before you use an SDK or call an API operation to upload media files. You need to parse UploadAuth only if you use OSS SDK or call an OSS API operation to upload media files.
    Value:
      Fn::GetAtt:
        - UploadMedia
        - UploadAuth
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "EntityId": {
      "Type": "String",
      "Description": {
        "en": "The entity ID. You can call the CreateEntity operation to create an entity and specify a dynamic metadata structure."
      },
      "Required": false
    },
    "AppId": {
      "Type": "String",
      "Description": {
        "en": "The application ID. Default value: app-1000000."
      },
      "Required": false
    },
    "FileInfo": {
      "Type": "Json",
      "Description": {
        "en": "The file information, which is in the JSON format and contains the following fields:\nType: required. The file type. Valid values: video, image, audio, text, and other.\nName: required. The file name without the extension.\nSize: optional. The file size.\nExt: required. The file name extension."
      },
      "Required": false
    },
    "UserData": {
      "Type": "Json",
      "Description": {
        "en": "The user data. The value must be a JSON string. You can configure settings such as message callbacks."
      },
      "Required": false
    },
    "UploadTargetConfig": {
      "Type": "Json",
      "Description": {
        "en": "The destination storage address.\nSet StorageType to oss.\nSet StorageLocation to an address in ApsaraVideo VOD. You cannot set this field to an OSS URL."
      },
      "Required": false
    },
    "MediaMetaData": {
      "Type": "Json",
      "Description": {
        "en": "The metadata of the media asset, which is a JSON string that contains the following fields:\nTitle: required.\nThe value can be up to 128 characters in length.\nThe value must be encoded in UTF-8.\nDescription: optional.\nThe value can be up to 1,024 characters in length.\nThe value must be encoded in UTF-8.\nCateId: optional.\nTags: optional.\nBusinessType: required. Valid values:\nopening or ending if Type is set to video\ndefault or cover if Type is set to image\nsubtitles or font if Type is set to text\nwatermark if Type is set to material\ngeneral CoverURL: optional.\nDynamicMetaData: The value is a string."
      },
      "Required": false
    },
    "PostProcessConfig": {
      "Type": "Json",
      "Description": {
        "en": "Type = video || audio There is a post-upload processing action. ProcessType Value: Workflow."
      },
      "Required": false
    }
  },
  "Resources": {
    "UploadMedia": {
      "Type": "ALIYUN::ICE::UploadMedia",
      "Properties": {
        "EntityId": {
          "Ref": "EntityId"
        },
        "AppId": {
          "Ref": "AppId"
        },
        "FileInfo": {
          "Ref": "FileInfo"
        },
        "UserData": {
          "Ref": "UserData"
        },
        "UploadTargetConfig": {
          "Ref": "UploadTargetConfig"
        },
        "MediaMetaData": {
          "Ref": "MediaMetaData"
        },
        "PostProcessConfig": {
          "Ref": "PostProcessConfig"
        }
      }
    }
  },
  "Outputs": {
    "FileURL": {
      "Description": "The OSS URL of the file. The URL does not contain the information used for authentication.",
      "Value": {
        "Fn::GetAtt": [
          "UploadMedia",
          "FileURL"
        ]
      }
    },
    "MediaURL": {
      "Description": "The URL of the media asset.\nNote If a domain name for Alibaba Cloud CDN (CDN) is specified, a CDN URL is returned. Otherwise, an OSS URL is returned. If the HTTP status code 403 is returned when you access the URL from your browser, the URL authentication feature of ApsaraVideo VOD is enabled. To resolve this issue, disable URL authentication or generate an authentication signature.",
      "Value": {
        "Fn::GetAtt": [
          "UploadMedia",
          "MediaURL"
        ]
      }
    },
    "UploadAddress": {
      "Description": "The upload URL.\nNote The returned upload URL is a Base64-encoded URL. You must decode the Base64-encoded upload URL before you use an SDK or call an API operation to upload media files. You need to parse UploadAddress only if you use OSS SDK or call an OSS API operation to upload media files.",
      "Value": {
        "Fn::GetAtt": [
          "UploadMedia",
          "UploadAddress"
        ]
      }
    },
    "MediaId": {
      "Description": "The ID of the media asset.",
      "Value": {
        "Fn::GetAtt": [
          "UploadMedia",
          "MediaId"
        ]
      }
    },
    "UploadAuth": {
      "Description": "The upload credential.\nNote The returned upload credential is a Base64-encoded value. You must decode the Base64-encoded upload URL before you use an SDK or call an API operation to upload media files. You need to parse UploadAuth only if you use OSS SDK or call an OSS API operation to upload media files.",
      "Value": {
        "Fn::GetAtt": [
          "UploadMedia",
          "UploadAuth"
        ]
      }
    }
  }
}