Search in sources :

Example 1 with AmazonElasticTranscoder

use of com.amazonaws.services.elastictranscoder.AmazonElasticTranscoder in project studio by craftercms.

the class ElasticTranscoderImpl method startJob.

@Override
public TranscoderJob startJob(String filename, InputStream content, TranscoderProfile profile) throws AwsException {
    try {
        AmazonS3 s3Client = getS3Client(profile);
        AmazonElasticTranscoder transcoderClient = getTranscoderClient(profile);
        Pipeline pipeline = getPipeline(profile.getPipelineId(), transcoderClient);
        String baseKey = FilenameUtils.removeExtension(filename) + "/" + UUID.randomUUID().toString();
        String inputKey = baseKey + "." + FilenameUtils.getExtension(filename);
        uploadInput(inputKey, filename, content, pipeline, s3Client);
        CreateJobResult jobResult = createJob(inputKey, baseKey, profile, transcoderClient);
        return createResult(baseKey, jobResult, pipeline);
    } catch (Exception e) {
        throw new AwsException("Error while attempting to start an AWS Elastic Transcoder job for file " + filename, e);
    }
}
Also used : AmazonS3(com.amazonaws.services.s3.AmazonS3) CreateJobResult(com.amazonaws.services.elastictranscoder.model.CreateJobResult) AmazonElasticTranscoder(com.amazonaws.services.elastictranscoder.AmazonElasticTranscoder) AwsException(org.craftercms.studio.api.v1.exception.AwsException) AwsException(org.craftercms.studio.api.v1.exception.AwsException) Pipeline(com.amazonaws.services.elastictranscoder.model.Pipeline)

Aggregations

AmazonElasticTranscoder (com.amazonaws.services.elastictranscoder.AmazonElasticTranscoder)1 CreateJobResult (com.amazonaws.services.elastictranscoder.model.CreateJobResult)1 Pipeline (com.amazonaws.services.elastictranscoder.model.Pipeline)1 AmazonS3 (com.amazonaws.services.s3.AmazonS3)1 AwsException (org.craftercms.studio.api.v1.exception.AwsException)1