lib/cloudinary/video_helper.rb in cloudinary-1.28.0 vs lib/cloudinary/video_helper.rb in cloudinary-1.29.0
- old
+ new
@@ -51,11 +51,11 @@
# :type => "webm",
# :transformations => { :video_codec => "auto" }
# }
# ])
def cl_video_tag(source, options = {}, &block)
- source = strip_known_ext(source)
+ source = strip_known_ext(source) unless Cloudinary::Utils.config_option_fetch(options, :use_fetch_format)
video_attributes = [:autoplay,:controls,:loop,:muted,:poster, :preload]
options = Cloudinary::Utils.deep_symbolize_keys(DEFAULT_VIDEO_OPTIONS.merge(options))
options[:source_types] ||= DEFAULT_SOURCE_TYPES
video_attributes.keep_if{ |key, _| options.has_key?(key)} # required prior to Rails 4.x
@@ -153,11 +153,12 @@
cloudinary_tag(source_name, options) do |_source, tag_options|
content_tag('video', tag_options.merge(video_options)) do
source_tags = sources.map do |source|
type = source[:type]
+ options[:format] = type
transformation = source[:transformations] || {}
- cloudinary_tag("#{source_name}.#{type}", options.merge(transformation)) do |url, _tag_options|
+ cloudinary_tag(source_name, options.merge(transformation)) do |url, _tag_options|
mime_type = "video/#{(type == 'ogv' ? 'ogg' : type)}"
if source[:codecs]
codecs = source[:codecs].is_a?(Array) ? source[:codecs].join(", ") : source[:codecs]
mime_type = "#{mime_type}; codecs=#{codecs}"
end