Skip to main content

Tutorial

Tutorial for sequence of calls to generate an asset and prepare HLS.

To upload the content and watch the video, you should follow this sequence.

Flow

Processo de Envio

Step 1 - Asset Creation

POST https://api.elasticencoder.videolib.live/dev/asset?option=createasset

{
"name":"assetName"
}

in the Name field, use a code to identify the source system. It can't be repeated, the display process will use this code to display the processed content.

Example of how the command return will be generated from the JSON below:

{
"guid": "asset-uniqueidAsset",
"application": "videolib-ecine-dev",
"name": "assetName",
"type": "M",
"creationTime": "2024-01-13T22:28:03.7749442Z",
"fileName": null,
"base64": null,
"publicUrl": null,
"blobSasUri": null,
"publishSasUri": null,
"files": null,
"md5": null,
"cod_erro": null,
"status_ret": null,
"erro": null
}

Step 2 - Submission of Original Content

POST https://api.elasticencoder.videolib.live/dev/asset?option=createassetfromcopyurl

{
"guid":"asset-uniqueidAsset",
"name":"assetName",
"fileName":"Original fileName.mp4",
"publicUrl":"https://portalplayerglobointegra.blob.core.windows.net/containervideosprod/1679138.mp4"
}

where publicUrl is the URL to access the original content (URL to copy the file).

Step 3 - Transcoding

POST https://api.elasticencoder.videolib.live/dev/job

{
"assetIdMezanine":"asset-uniqueidAsset",
"jobName":"Job Name (External Control)",
"presetId":"preset code (*)"

}

Step 4 - Process Follow-Up

Verification of Jobs.

GET https://api.elasticencoder.videolib.live/dev/job

Example of how the command return will be generated from the JSON below:

{
"codMensagem": null,
"rows": 1,
"continuationToken": null,
"items": [
{
"guid": "job-2516970584269866335-f92daed3-a6ad-483e-9d11-e67aed51be73",
"application": "videolib-ecine-dev",
"assetIdMezanine": "asset-2516971159162250822-b3f503f5-241d-4c1b-876b-bcaf006e02e3",
"assetIdEncoded": null,
"presetId": "71",
"jobName": "job-001",
"startTime": null,
"finishTime": null,
"jobStatus": 0, -- Indicates the status of processing.
"percent": null,
"duration": null,
"message": null,
"errorMessage": null,
"errorCode": null,
"listaMarcacoes": null,
"timestamp": null,
"cod_erro": null,
"status_ret": null,
"erro": null
}
],
"cod_erro": null,
"status_ret": null,
"erro": null
}

Where:

jobStatus - Job status
0 - Waiting
1 - Added to the Processing Queue
2 - Processing
3 - Successfully completed
4 - Terminated with error
startTime - Start of processing
finishTime - End of processing
percent - Processing Percentage
duration - Video Length
message - Encoder Log
errorMessage - in case there is an error in the processing.
assetIdEncoded - ID of the newly generated asset

Step 5 - Content Display

POST https://api.elasticencoder.videolib.live/dev/auth

{
"app":"application", // Application code (submitted for activation)
"key":"key",// authentication key (sent for activation)
"userName":"User id", // source system user id - audience id
"name":"Username", // source system username - audience ID
"group":"100", // (Optional) Source System Group ID - Audience ID
"email":"usuario@email.com.br", // (optional) email of the user from the source system - audience ID
"documentId":"Document Number - ex: cpf", // (optional) source system user document
"department":"department name", // (optional) department of the source system user
"timeoutMinutes":"20" // Token duration time
}

As a return of the command, the following JSON will be generated:

{
"token":"eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyTmFtZSI6ImlkVXN1YXJvIiwibmFtZSI6Ik5vbWUgVXN1YXJpbyIsImRhdGFUb2tlbiI6IjIwMjQtMDEtMjdUMjI6MjI6MjcuOTI0NzU1LTAzOjAwIiwiZ3JvdXAiOiIxMDAiLCJlbWFpbCI6InV1c3VhcmlvQGVtYWlsLmNvbS5iciIsImRvY3VtZW50SWQiOiJudW0gZG9jdW1lbnRvIC0gZXg6IGNwZiIsImRlcGFydG1lbnQiOiJub21lIGRlcGFydGFtZW50byIsIm1hdGNoIjoiODAyYmVjOGZkNTMxODE5MmIwYTc1IiwiaWRVc2VyUXVldWUiOiIwRTQ5RDM2ODMxNEM0NUJBMjJBQzYxRDY3MzA0MDYwREU1RDhFODE1OENBRjlFRDM4RDIyMjY1NzMwOTBDRDA4Iiwicm9sZXMiOiJHZXN0b3IifQ.yChC56edU1zmCua7sodHGVCD-rrMp5SCeIerkeK2llI",
"dataToken":"2024-01-27T22:22:27.924755-03:00",
"userName":"User ID",
"name":"Username"
,"tokenType":"jwt",
"idUserQueue":"0E49D368314C45BA22AC61D67304060DE5D8E8158CAF9ED38D2226573090CD08",
"group":"100",
"roles":"",
"email":"usuario@email.com.br",
"documentId":"Document Number - ex: cpf",
"department":"Department Name",
"status_ret":null,
"erro":null
}

Opening the Player:

https://player.elasticencoder.videolib.live/player?token=mezanino-1&jwt=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyTmFtZSI6ImlkVXN1YXJvIiwibmFtZSI6Ik5vbWUgVXN1YXJpbyIsImRhdGFUb2tlbiI6IjIwMjQtMDEtMjdUMjI6MjI6MjcuOTI0NzU1LTAzOjAwIiwiZ3JvdXAiOiIxMDAiLCJlbWFpbCI6InV1c3VhcmlvQGVtYWlsLmNvbS5iciIsImRvY3VtZW50SWQiOiJudW0gZG9jdW1lbnRvIC0gZXg6IGNwZiIsImRlcGFydG1lbnQiOiJub21lIGRlcGFydGFtZW50byIsIm1hdGNoIjoiODAyYmVjOGZkNTMxODE5MmIwYTc1IiwiaWRVc2VyUXVldWUiOiIwRTQ5RDM2ODMxNEM0NUJBMjJBQzYxRDY3MzA0MDYwREU1RDhFODE1OENBRjlFRDM4RDIyMjY1NzMwOTBDRDA4Iiwicm9sZXMiOiJHZXN0b3IifQ.yChC56edU1zmCua7sodHGVCD-rrMp5SCeIerkeK2llI

Where:

Player Url: 
https://player.elasticencoder.videolib.live/player

Parameters:
token: Name given to the original file asset
jwt: key generated in the auth API call (explained at the start of the session)

Player Videolib