Skip to content

Instantly share code, notes, and snippets.

@weavermedia
Last active December 30, 2015 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weavermedia/7850235 to your computer and use it in GitHub Desktop.
Save weavermedia/7850235 to your computer and use it in GitHub Desktop.
Serve original video or encoded versions depending on job status
# serve original video or encoded versions if the encoding job is complete
# using mutiple sources inside the <video> tag
<% orig = upload.direct_upload_url %>
<% mp4 = webm = jpg = nil %>
<% if upload.encode_is_complete %>
<% orig = nil %>
<% mp4 = upload.base_url + '.mp4' %>
<% webm = upload.base_url + '.webm' %>
<% jpg = upload.base_url + '-00001.jpg' %>
<% end %>
<%= video_tag [mp4, webm, orig], poster: jpg, controls: true, autobuffer: false %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment