重新加载页面静音视频工作与声音

时间:2018-02-08 06:15:47

标签: ruby-on-rails ruby html5-video

这是我的代码: 的 index.slim

 .background_video
   = video_tag 'background.mp4', loop: :loop, autoplay: :autoplay, muted: true, class: 'videos'
 .search.col-lg-6.search_form
   label.col-lg-12
     = form_tag(searches_path, method: 'get', class: 'search_form_tag') do
       br
       = text_field_tag :q, nil, placeholder: 'search everything here', class: 'search_field', autofocus: true

_header.slim:

.container
  header
    = link_to root_path, class: 'link_logo_image'
      = image_tag ("WHERE_LOGO.png"), class: 'logo_image'

点击= link_to root_path, class: 'link_logo_image'重新加载页面并开始播放音乐

首先打开没有声音的页面视频播放。 当我打开管理页面或重新加载主页视频开始声音。 在我的主页上是src =#的按钮。点击此按钮后,视频也会以声音开始。

1 个答案:

答案 0 :(得分:0)

这是工作:

= link_to '', root_path, class: 'items__footage', :"data-turbolinks" => false