Salesforce

Translate TTML

« Go Back
Information
Translate TTML
000004088
Public
Product Selection
aiWare - aiWare
Article Details

These examples show how to use the aiWARE environment to translate TTML (Timed Text Markup Language).

Engines

These engines will be used for this TTML translation:

NameDescription
Igniter EngineWrapper for payload to AS Engine
Automate Studio EngineEngine wrapper for AS Workflow Endpoint
Translation EngineRun AI on the stream
Output Writer EngineAggregate output and store in TDO

 

Code examples

Use the GraphQL endpoint for aiWARE (/v3/graphql) to enter the GraphQL query below and update the payload data.

Create TDO with asset DAG

A TDO (Temporal Data Object) is created with the original TTML as the primary asset. This TDO is used in the TTML Translation examples below.

GQL createTDOWithAsset mutation payload:

Example

{
    "currentDate": "1646764965",  // Current timestamp
    "ttmlUrl": "https://example.com/path-to-ttml"
}

GQL createTDOWithAsset mutation:

Example

mutation createTDOForTTML(
    $currentDate: DateTime!,
    $ttmlUrl: String!
){
    createTDOWithAsset(
        input: {
            status: "recorded",
            startDateTime: $currentDate,
            contentType: "application/ttml+xml",
            assetType: "media",
            uri: $ttmlUrl
        })
        { 
            id 
            status 
            assets { 
                records { 
                    id 
                    assetType 
                    contentType 
                    signedUri 
                } 
            } 
        } 
    }

Response

{
    "data": {
        "createTDOWithAsset": {
            "id": "<TDO ID>",
            "status": "recorded",
            "assets": {
                "records": [
                    {
                        "id": "<TDO>_zDFKLx9mfl",
                        "assetType": "media",
                        "contentType": "application/ttml+xml",
                        "signedUri": "<URL FOR TTML>"
                    }
                ]
            }
        }
    }
}

TTML translation DAG

This creates a job that takes a payload consisting of the URL location of the TTML, the target language, and optionally a TDO or webhook to write the output for notification/additional processing. The return consists of job IDs that you can use to check the job progress status.

GQL createJob mutation payload:

Example

{
  "tdo": "<TDO ID>", // Target TDO from CreateTDO DAG above
  "url": "https://example.com/path-to-ttml", // TTML URL
  "lang": "de",
  "webhook": "https://webhook.example.com", // Webhook URL - optional
}

GQL createJob mutation:

Example

mutation AutomateDAG (
    $tdo: ID!,
    $url: String!,
    $lang: String!,
    $webhook: String
) {
  createJob(input: { 
    status:"downloaded",
    targetId: $tdo,
    clusterId :"prd5-21xbyq0x-4h0s-o685-snas-oovhdai552v9",
    tasks: [
       {
        # Igniter-V3F 
        engineId: "5305265c-d566-4716-8904-debf7e0ac857"
         payload: {
                    tdo: $tdo,
                    url: $url,
                    lang: $lang,
                    webhook: $webhook
                    }
         ioFolders: [
            { referenceId: "igniteOutputFolder", mode: chunk, type: output }
          ]
        executionPreferences: { priority: 10 }
      }
      {
         # Automate Studio Flow
         engineId: "4c59883a-c47e-484b-b12d-3db584d6426e"
         ioFolders: [
            { referenceId: "engineInputFolder", mode: chunk, type: input }
            { referenceId: "engineOutputFolder", mode: chunk, type: output }
          ]
        executionPreferences: { priority: 10 }
      }
    ]
    routes: [
        {  
          # Input --> Engine
          parentIoFolderReferenceId: "igniteOutputFolder"
          childIoFolderReferenceId: "engineInputFolder"
          options: {}
        }
      ]
  }) {
    id
    tasks{
      records{
        id
        output
      }
    }
  }
}

Response

{
  "data": {
    "createJob": {
      "id": "22030901_PSUipJNtRL",
      "tasks": {
        "records": [
          {
            "id": "22030901_PSUipJNtRLerYpm",
            "output": null
          },
          {
            "id": "22030901_PSUipJNtRLkRLw6",
            "output": null
          }
        ]
      }
    }
  }
}

Webhook payload

The webhook endpoint, if provided in the payload example above, sends a notification of process completion. Its payload consists of a message of completion and a signed URL of the translated TTML.

Example

{
    "type": "ttml.translated",
    "tdo": <TDO_ID>,
    "url": "https://s3-ttml-translation.s3.us-east-2.amazonaws.com/ttml/signed-url-of-translated-ttml-output"
}
Additional Technical Documentation Information
Properties
1/8/2024 6:06 PM
1/8/2024 6:06 PM
1/8/2024 6:06 PM
Documentation
Documentation
000004088
Translation Information
English

Powered by