Search in sources :

Example 1 with CreateJobPlaylist

use of com.amazonaws.services.elastictranscoder.model.CreateJobPlaylist in project aws-doc-sdk-examples by awsdocs.

the class HlsJobCreationSample method createElasticTranscoderHlsJob.

/**
 * Creates a job which outputs an HLS playlist for adaptive bitrate playback.
 * @return Job that was created by Elastic Transcoder.
 * @throws Exception
 */
private static Job createElasticTranscoderHlsJob() throws Exception {
    // Setup the job input using the provided input key.
    JobInput input = new JobInput().withKey(INPUT_KEY);
    // Setup the job outputs using the HLS presets.
    String outputKey = TranscoderSampleUtilities.inputKeyToOutputKey(INPUT_KEY);
    CreateJobOutput hlsAudio = new CreateJobOutput().withKey("hlsAudio/" + outputKey).withPresetId(HLS_64K_AUDIO_PRESET_ID).withSegmentDuration(SEGMENT_DURATION);
    CreateJobOutput hls0400k = new CreateJobOutput().withKey("hls0400k/" + outputKey).withPresetId(HLS_0400K_PRESET_ID).withSegmentDuration(SEGMENT_DURATION);
    CreateJobOutput hls0600k = new CreateJobOutput().withKey("hls0600k/" + outputKey).withPresetId(HLS_0600K_PRESET_ID).withSegmentDuration(SEGMENT_DURATION);
    CreateJobOutput hls1000k = new CreateJobOutput().withKey("hls1000k/" + outputKey).withPresetId(HLS_1000K_PRESET_ID).withSegmentDuration(SEGMENT_DURATION);
    CreateJobOutput hls1500k = new CreateJobOutput().withKey("hls1500k/" + outputKey).withPresetId(HLS_1500K_PRESET_ID).withSegmentDuration(SEGMENT_DURATION);
    CreateJobOutput hls2000k = new CreateJobOutput().withKey("hls2000k/" + outputKey).withPresetId(HLS_2000K_PRESET_ID).withSegmentDuration(SEGMENT_DURATION);
    List<CreateJobOutput> outputs = Arrays.asList(hlsAudio, hls0400k, hls0600k, hls1000k, hls1500k, hls2000k);
    // Setup master playlist which can be used to play using adaptive bitrate.
    CreateJobPlaylist playlist = new CreateJobPlaylist().withName("hls_" + outputKey).withFormat("HLSv3").withOutputKeys(hlsAudio.getKey(), hls0400k.getKey(), hls0600k.getKey(), hls1000k.getKey(), hls1500k.getKey(), hls2000k.getKey());
    // Create the job.
    CreateJobRequest createJobRequest = new CreateJobRequest().withPipelineId(PIPELINE_ID).withInput(input).withOutputKeyPrefix(OUTPUT_KEY_PREFIX + outputKey + "/").withOutputs(outputs).withPlaylists(playlist);
    return amazonElasticTranscoder.createJob(createJobRequest).getJob();
}
Also used : JobInput(com.amazonaws.services.elastictranscoder.model.JobInput) CreateJobPlaylist(com.amazonaws.services.elastictranscoder.model.CreateJobPlaylist) CreateJobOutput(com.amazonaws.services.elastictranscoder.model.CreateJobOutput) CreateJobRequest(com.amazonaws.services.elastictranscoder.model.CreateJobRequest)

Aggregations

CreateJobOutput (com.amazonaws.services.elastictranscoder.model.CreateJobOutput)1 CreateJobPlaylist (com.amazonaws.services.elastictranscoder.model.CreateJobPlaylist)1 CreateJobRequest (com.amazonaws.services.elastictranscoder.model.CreateJobRequest)1 JobInput (com.amazonaws.services.elastictranscoder.model.JobInput)1