0

I'm creating an integration with Elastic Transcoder, with this class: https://github.com/LPology/ElasticTranscoderPHP (for environment reasons)

The problem occurs when I want to create a job and I pass the playlists configuration as a parameter. This is where the service responds "'Start of structure or map found where not expected."

I tried, excluding the configuration object from the playlist, and the Job is created correctly, but when I include it, it throws the aforementioned error.

// Function that creates the job
function createJobAwsHLS($Key, $pipelineId, $idReg) {
    global $accessKey, $secretKey;
    $etc = new \knik\aws\ElasticTranscoder($accessKey, $secretKey);
    $input = [
        "Key" => $Key,
        "FrameRate" => "auto",
        "Resolution" => "auto",
        "AspectRatio" => "auto",
        "Interlaced" => "auto",
        "Container" => "auto"
    ];
    $outputs = [
        [
            'Key' => 'hls_400_',
            'PresetId' => '1351620000001-200050',
            'OutputDuration'=> 10,
        ],
        [
            'Key' => 'hls_1000_',
            'PresetId' => '1351620000001-200030',
            'OutputDuration' => 10,
        ],
        [
            'Key' => 'hls_2000_',
            'PresetId' => '1351620000001-200010',
            'OutputDuration' => 10,
        ]
    ];
    $pipelineId = $pipelineId;
    $outputKeyPrefix = 'repositorio/' . $idReg++ . '/hls/';
    $playlists = [
        'Name' => 'index',
        'OutputKeys' => ['hls_400_', 'hls_1000_', 'hls_2000_']
    ];
    $usermetadata = null;
    try {
        $response = $etc->createJob($input ,$outputs ,$pipelineId ,$outputKeyPrefix ,$playlists ,$usermetadata);
        if($response!==false) return $response['Job']['Id'];
        return '';
    } catch (Exception $err) {
        return '';
    }
}

0 Answers0