templates/video.html.slim in asciidoctor-revealjs-4.0.1 vs templates/video.html.slim in asciidoctor-revealjs-4.1.0.rc2
- old
+ new
@@ -2,37 +2,43 @@
/ unless already specified
- no_stretch = ((attr? :width) || (attr? :height))
- width = (attr? :width) ? (attr :width) : "100%"
- height = (attr? :height) ? (attr :height) : "100%"
/ we apply revealjs stretch class to the videoblock take all the place we can
-.videoblock id=@id class=[@style,role,(no_stretch ? nil : "stretch")]
+= html_tag('div', { :id => @id, :class => ['videoblock', @style, role, (no_stretch ? nil : 'stretch'), ('fragment' if (option? :step) || (has_role? 'step') || (attr? 'step'))] }.merge(data_attrs(@attributes)))
- if title?
.title=captioned_title
- case attr :poster
- when 'vimeo'
- unless (asset_uri_scheme = (attr :asset_uri_scheme, 'https')).empty?
- asset_uri_scheme = %(#{asset_uri_scheme}:)
- start_anchor = (attr? :start) ? "#at=#{attr :start}" : nil
- - delimiter = '?'
- - loop_param = (option? 'loop') ? "#{delimiter}loop=1" : nil
- - src = %(#{asset_uri_scheme}//player.vimeo.com/video/#{attr :target}#{start_anchor}#{loop_param})
+ - delimiter = ['?']
+ - loop_param = (option? 'loop') ? %(#{delimiter.pop || '&'}loop=1) : ''
+ - muted_param = (option? 'muted') ? %(#{delimiter.pop || '&'}muted=1) : ''
+ - src = %(#{asset_uri_scheme}//player.vimeo.com/video/#{attr :target}#{loop_param}#{muted_param}#{start_anchor})
+ / We need to delegate autoplay into the iframe starting with Chrome 62 (and other browsers too)
+ / See https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#iframe
iframe(width=(width) height=(height) src=src frameborder=0
webkitAllowFullScreen=true mozallowfullscreen=true allowFullScreen=true
- data-autoplay=(option? 'autoplay'))
- / data-autoplay is not supported on vimeo videos
- / upstream: https://github.com/hakimel/reveal.js/issues/388
+ data-autoplay=(option? 'autoplay')
+ allow=((option? 'autoplay') ? "autoplay" : nil))
- when 'youtube'
- unless (asset_uri_scheme = (attr :asset_uri_scheme, 'https')).empty?
- asset_uri_scheme = %(#{asset_uri_scheme}:)
- params = ['rel=0']
- params << "start=#{attr :start}" if attr? :start
- params << "end=#{attr :end}" if attr? :end
- params << "loop=1" if option? 'loop'
+ - params << "mute=1" if option? 'muted'
- params << "controls=0" if option? 'nocontrols'
- src = %(#{asset_uri_scheme}//www.youtube.com/embed/#{attr :target}?#{params * '&'})
+ / We need to delegate autoplay into the iframe starting with Chrome 62 (and other browsers too)
+ / See https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#iframe
iframe(width=(width) height=(height) src=src
frameborder=0 allowfullscreen=!(option? 'nofullscreen')
- data-autoplay=(option? 'autoplay'))
+ data-autoplay=(option? 'autoplay')
+ allow=((option? 'autoplay') ? "autoplay" : nil))
- else
video(src=media_uri(attr :target) width=(width) height=(height)
poster=((attr :poster) ? media_uri(attr :poster) : nil)
data-autoplay=(option? 'autoplay') controls=!(option? 'nocontrols')
loop=(option? 'loop'))