Class ElasticTranscoderImpl

  • All Implemented Interfaces:
    ElasticTranscoder

    public class ElasticTranscoderImpl
    extends Object
    implements ElasticTranscoder
    Default implementation of ElasticTranscoder. Just as indicated by the interface, the video file is first uploaded to the S3 input bucket of the AWS Elastic Transcoder pipeline, but before uploading, a unique bucket key is generated so that there's no issue when a file with the same filename is uploaded several times. In this way all video file versions (original or transcoded) are kept at all times and there's no downtime when a file is transcoded again.
    Author:
    avasquez
    • Field Detail

      • partSize

        protected int partSize
    • Constructor Detail

      • ElasticTranscoderImpl

        public ElasticTranscoderImpl()
    • Method Detail

      • setPartSize

        public void setPartSize​(int partSize)
      • startJob

        public TranscoderJob startJob​(String filename,
                                      InputStream content,
                                      TranscoderProfile profile)
                               throws AwsException
        Description copied from interface: ElasticTranscoder
        Starts a transcoder job for the specified file, based on the given TranscoderProfile. It first uploads the file to the input bucket in S3 before the job is created.
        Specified by:
        startJob in interface ElasticTranscoder
        Parameters:
        filename - the video's file name
        content - the file of the video
        profile - the transcoding profile
        Returns:
        the metadata of the transcoder job. It's important to point out that returning the job info doesn't mean that the job has been completed. To monitor the progress of the job the returned job ID can be used.
        Throws:
        AwsException - if an error occurred
      • getPipeline

        protected com.amazonaws.services.elastictranscoder.model.Pipeline getPipeline​(String pipelineId,
                                                                                      com.amazonaws.services.elastictranscoder.AmazonElasticTranscoder client)
      • uploadInput

        protected void uploadInput​(String inputKey,
                                   String filename,
                                   InputStream content,
                                   com.amazonaws.services.elastictranscoder.model.Pipeline pipeline,
                                   com.amazonaws.services.s3.AmazonS3 s3Client)
                            throws AwsException
        Throws:
        AwsException
      • createJob

        protected com.amazonaws.services.elastictranscoder.model.CreateJobResult createJob​(String inputKey,
                                                                                           String baseKey,
                                                                                           TranscoderProfile profile,
                                                                                           com.amazonaws.services.elastictranscoder.AmazonElasticTranscoder transcoderClient)
      • createResult

        protected TranscoderJob createResult​(String baseKey,
                                             com.amazonaws.services.elastictranscoder.model.CreateJobResult jobResult,
                                             com.amazonaws.services.elastictranscoder.model.Pipeline pipeline)
      • getS3Client

        protected com.amazonaws.services.s3.AmazonS3 getS3Client​(TranscoderProfile profile)
      • getTranscoderClient

        protected com.amazonaws.services.elastictranscoder.AmazonElasticTranscoder getTranscoderClient​(TranscoderProfile profile)
      • getCreateJobRequest

        protected com.amazonaws.services.elastictranscoder.model.CreateJobRequest getCreateJobRequest​(String inputKey,
                                                                                                      String baseKey,
                                                                                                      TranscoderProfile profile)
      • getCreateJobOutput

        protected com.amazonaws.services.elastictranscoder.model.CreateJobOutput getCreateJobOutput​(String baseKey,
                                                                                                    TranscoderOutput output)