Accessing Media from Templates

You can access the transcoded versions of a video/audio clip from your JSP templates using JSTL as follows (in all the examples video-field-name is the name of the video field in your content type and audio-field-name is the name of the audio field in your content type and index is the index of the transcoded version you want).

Note that if a video's transcoded outputs include an HLS stream, then the number of transcoded versions will not match the number of presets in the selected preset group, since all HLS presets are merged and result in only one HLS stream. For further information about this, see Using HLS Video Presets.

  • To access the URI of a transcoded video:

    ${article.fields.video-field-name.value.video[index].uri}
  • To access the video's MIME type:

    ${article.fields.video-field-name.value.video[index]['mime-type']}

    HLS streams generated by Elastic Transcoder are given the MIME type application/x-mpegURL.

  • To access the video's height:

    ${article.fields.video-field-name.value.video[index].height}
  • To access the video's width:

    ${article.fields.video-field-name.value.video[index].width}
  • To access the video's duration:

    ${article.fields.video-field-name.value.duration}
  • To access the video's timeline information:

    ${article.fields.video-field-name.value.timeline.cuepoints}
    ${article.fields.video-field-name.value.timeline.tracks}
    ${article.fields.video-field-name.value.playback}
  • To access the video's key frames:

    ${article.relatedElements.KEYFRAMES.items}

    If a poster frame is selected than the first key frame will be the poster frame.