use of com.amazonaws.services.mediaconvert.model.CreateJobRequest in project studio by craftercms.
the class AwsMediaConvertServiceImpl method uploadVideo.
/**
* {@inheritDoc}
*/
@Override
@HasPermission(type = DefaultPermission.class, action = "s3 write")
public MediaConvertResult uploadVideo(@ValidateStringParam @ProtectedResourceId("siteId") final String site, @ValidateStringParam final String inputProfileId, @ValidateStringParam final String outputProfileId, @ValidateStringParam final String filename, final InputStream content) throws AwsException {
MediaConvertProfile profile = getProfile(site, inputProfileId);
AmazonS3 s3Client = getS3Client(profile);
AWSMediaConvert mediaConvertClient = getMediaConvertClient(profile);
logger.info("Starting upload of file {0} for site {1}", filename, site);
AwsUtils.uploadStream(profile.getInputPath(), filename, s3Client, partSize, filename, content);
logger.info("Upload of file {0} for site {1} complete", filename, site);
String originalName = FilenameUtils.getBaseName(filename);
JobTemplate jobTemplate = mediaConvertClient.getJobTemplate(new GetJobTemplateRequest().withName(profile.getTemplate())).getJobTemplate();
JobSettings jobSettings = new JobSettings().withInputs(new Input().withFileInput(AwsUtils.getS3Url(profile.getInputPath(), filename)));
CreateJobRequest createJobRequest = new CreateJobRequest().withJobTemplate(profile.getTemplate()).withSettings(jobSettings).withRole(profile.getRole()).withQueue(profile.getQueue());
logger.info("Starting transcode job of file {0} for site {1}", filename, site);
CreateJobResult createJobResult = mediaConvertClient.createJob(createJobRequest);
logger.debug("Job {0} started", createJobResult.getJob().getArn());
return buildResult(jobTemplate, createJobResult, outputProfileId, originalName);
}
use of com.amazonaws.services.mediaconvert.model.CreateJobRequest in project studio by craftercms.
the class MediaConvertImpl method startJob.
/**
* {@inheritDoc}
*/
@Override
public MediaConvertJob startJob(final String filename, final InputStream content, final MediaConvertProfile profile) throws AwsException {
AmazonS3 s3Client = getS3Client(profile);
AWSMediaConvert mediaConvertClient = getMediaConvertClient(profile);
AwsUtils.uploadStream(profile.getInputPath(), filename, s3Client, partSize, filename, content);
String key = FilenameUtils.getBaseName(filename);
JobTemplate jobTemplate = mediaConvertClient.getJobTemplate(new GetJobTemplateRequest().withName(profile.getTemplate())).getJobTemplate();
JobSettings jobSettings = new JobSettings().withInputs(new Input().withFileInput(AwsUtils.getS3Url(profile.getInputPath(), filename)));
CreateJobRequest createJobRequest = new CreateJobRequest().withJobTemplate(profile.getTemplate()).withSettings(jobSettings).withRole(profile.getRole()).withQueue(profile.getQueue());
CreateJobResult createJobResult = mediaConvertClient.createJob(createJobRequest);
return createMediaConverJob(createJobResult, getJobDestination(jobTemplate), key);
}
Aggregations