/ in a slide-deck context we assume video should take as much place as possible / 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 = 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.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') 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') 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')) |Your browser does not support the video tag.