Tous les produits
Search
Centre de documentation

ApsaraVideo Media Processing:Recevoir des notifications

Dernière mise à jour :Aug 24, 2026

Une fois la notification envoyée, vous la recevez dans la file d'attente ou le topic Simple Message Queue (SMQ) spécifié. Cette rubrique explique comment recevoir ces notifications.

Prérequis

La fonctionnalité de notification est activée. Pour plus d'informations, consultez la rubrique Configurer les notifications.

Recevoir des notifications dans une file d'attente MNS

Recevoir des notifications dans un topic MNS

Format de message pour une tâche

Paramètre

Description

jobId(JobId)

ID de la tâche.

requestId(RequestId)

ID de la requête.

type(Type)

Type de la tâche. Valeurs possibles :

  • Transcode : tâche de transcodage

  • Analysis : tâche d'analyse de modèle intelligent

  • Snapshot : tâche de capture d'écran

  • MediaInfo : tâche d'analyse des informations multimédias

state(State)

État de la tâche. Valeurs possibles :

  • Success : la tâche a réussi.

  • Fail : la tâche a échoué.

code

Code d'erreur renvoyé en cas d'échec de la tâche.

msg

Message d'erreur renvoyé en cas d'échec de la tâche.

UrlPattern

URL de la capture d'écran contenant des espaces réservés. La valeur de ce paramètre sert de modèle d'URL.

Remarque

Ce paramètre est renvoyé si le paramètre type(Type) est défini sur Snapshot et que des captures d'écran sont prises à des instants précis.

LastUrl

URL de la dernière capture d'écran.

Remarque

Ce paramètre est renvoyé si le paramètre type(Type) est défini sur Snapshot et que des captures d'écran sont prises à des instants précis.

Count

Nombre total de captures d'écran.

Remarque

Ce paramètre est renvoyé si le paramètre type(Type) est défini sur Snapshot et que des captures d'écran sont prises à des instants précis.

TimeArray

Instant auquel une capture d'écran est prise.

Remarque

Ce paramètre est renvoyé si le paramètre type(Type) est défini sur Snapshot et que des captures d'écran sont prises à des instants précis.

Exemple de rappel réussi

{
  "jobId": "8f91f1b630f3469eb5ecf445028f****",
  "JobId": "8f91f1b630f3469eb5ecf445028f****",
  "Type": "Snapshot",
  "userData": "{}",
  "UserData": "{}",
  "State": "Success",
  "state": "Success",
  "type": "Snapshot",

  "LastUrl": "http://example.oss-cn-shanghai.aliyuncs.com/example_output/2021-11-14/V4/Async-V2-00005.jpg",
  "TimeArray": [10050, 50000, 110000, 1000500, 1100500],
  "UrlPattern": "http://eaxmple.oss-cn-shanghai.aliyuncs.com/example_output/2021-11-14/V4/Async-V2-{Count}.jpg",
  "Count": 5
}

Exemple de rappel ayant échoué

{
  "msg": "TimeArray greater than video duration.",
  "Msg": "TimeArray greater than video duration.",
  "code": "InvalidParameter.TimeArray",
  "userData": "{}",
  "UserData": "{}",
  "type": "Snapshot",
  "Code": "InvalidParameter.TimeArray",
  "jobId": "f8abc5d9dee0425fa26bb9946df1****",
  "Type": "Snapshot",
  "State": "Fail",
  "UrlPattern": "http://example.oss-cn-shanghai.aliyuncs.com/example_output/2023-11-15/regression_test/TimePoint/V1/Async-V1-{Count}.jpg",
  "TimeArray": [10050, 50000, 110000, 1000500, 1100500, 1800000],
  "state": "Fail",
  "JobId": "f8abc5d9dee0425fa26bb9946df1****"
}

Format de message pour un workflow

Un message envoyé en tant que notification pour un workflow multimédia est au format JSON. Pour plus d'informations sur les paramètres du message, consultez la description des messages de workflow multimédia dans la rubrique Ajouter un fichier multimédia.

Structure du message :

  • Start

    Le activity type dans les basic attributes of the activity est Start.

  • Structure

    Le code suivant illustre la structure.

  • Report

    Le activity type dans les basic attributes of the activity est Report.

  • Exemple de code

    { 
          // The parameters in the top level, which are in the JSON format. The parameters define the basic attributes of the activity and the information about the workflow.
          // The basic attributes of the activity are not independent objects, but key-value pairs that directly belong to the top level. The basic attributes include the ID of the workflow instance, activity name, activity type, activity status, and error message if the workflow fails.
          "RunId": "8f8aba5a62ab4127ae2add18da20****",
          "Name": "Act-4",
          "Type": "Report",
          "State": "Success",
          // The information about the workflow, which is in the JSON format. The information includes the ID of the workflow instance, the ID of the media workflow, the name of the media workflow, the media ID, the input file, the type of the workflow instance, the array of activity objects, and the time when the workflow instance is created.
          "MediaWorkflowExecution": {
            "Name": "ConcurrentSuccess",
            "RunId": "8f8aba5a62ab4127ae2add18da20****",
            "Input": {
                "InputFile": {
                    "Bucket": "exampleBucket****",
                    "Location": "oss-test", 
                   "Object": "mediaWorkflow/ConcurrentSuccess/01.wmv",
               }
            },
            "State": "Success",
            "MediaId": "2be491ab4cb6499cd0befe5fcf0c****",
            // The array of activity objects, which is in the JSON format. The array includes all activity objects related to the current workflow execution status.
            For example, only the Start activity object is included in a message for notifying you that the execution of the workflow starts, and all activity objects are included in a message for notifying you that the execution of the workflow ends. 
            // Example: Activity object 1, Activity object 2,...
            "ActivityList": 
    [
                // The information about the activity object, which is in the JSON format. The information includes the activity name, activity type, job ID, activity status, start time, end time, and the error message if the activity fails.    
                {
                    "RunId": "8f8aba5a62ab4127ae2add18da20****",
                    "Name": "Act-1",
                    "Type": "Start",
                    "State": "Success",
                    "StartTime": "2016-03-15T02: 53: 41Z",
                    "EndTime": "2016-03-15T02: 53: 41Z",
                },
                {                
                    "RunId": "8f8aba5a62ab4127ae2add18da20****",
                    "Name": "Act-2",
                    "Type": "Transcode",
                    "JobId": "f34b6d1429dd491faa7a6c1c8f90****",
                    "State": "Success",
                    "StartTime": "2016-03-15T02: 53: 43Z",
                    "EndTime": "2016-03-15T02: 53: 47Z",
                },
                {                
                    "RunId": "8f8aba5a62ab4127ae2add18da20****",
                    "Name": "Act-3",
                    "Type": "Snapshot",
                    "JobId": "c14150be33304825a5d67cd5364c****",
                    "State": "Success",
                    "StartTime": "2016-03-15T02: 53: 44Z",                
                    "EndTime": "2016-03-15T02: 53: 45Z",
                },
                {                
                    "RunId": "8f8aba5a62ab4127ae2add18da20****",
                    "Name": "Act-4",
                    "Type": "Report",
                    "State": "Success",
                    "StartTime": "2016-03-15T02: 53: 49Z",
                    "EndTime": "2016-03-15T02: 53: 49Z", 
               }
            ],
            "CreationTime": "2016-03-15T02: 53: 39Z",
          }
      }