React js停止循环背景视频

Axi*_*xis 2 html javascript reactjs

我正在尝试制作一个带有循环背景视频的页面React js

当我编译代码时,我可以看到视频正在浏览器上立即播放,但是当我单击网站链接时,视频没有播放。我应该单击Home页面中的按钮并重新开始。

我用了

<video src={BackVideo} autoplay="true" loop="true">
Run Code Online (Sandbox Code Playgroud)

我无法使用:

react-native-video

库,因为当我在代码中导入库时出现错误。

另外,我还有一个问题,视频Safari根本无法播放。

有人能帮助我吗。

Javascript这是我的文件部分

render() {
    return (
      <div>
        <div className="bgded overlay">
        {/* Menu, call the menu component with the ChangeViewButtonClick function recieved from Dashbaord */}
          <Menu ChangeViewButtonClick={this.props.ChangeViewButtonClick} />

        </div>

        <header className="v-header container">

      <div class="fullscreen-video-wrap">

        <video src={BackVideo} autoplay="true" loop="true"> </video>

    </div>
    <div className="header-overlay"></div>
    <div className="header-content">

       <article>
              <h1 className="heading">Something</h1>
              <h2 className="heading">something too</h2>



            </article>

    </div>
       </header>

        {/* Start of Overview */}
        <div className="wrapper row3">
          <main className="hoc container clear">
            <article className="two_third first">
              <h4 className="font-x2 font-x3">
                Lorem ipsum dolor sit, amet consectetur adipisicing elit. 
                Exercitationem, nihil.
              </h4>


            </article>

          </main>
        </div>
        {/* End of Overview */}
      </div>
Run Code Online (Sandbox Code Playgroud)

Axi*_*xis 5

我发现可能有人也有同样的问题。

使用自动播放循环静音

<video className='VideoTag' autoPlay loop muted>
      <source src={BackVideo} type='video/mp4'/>
</video>
Run Code Online (Sandbox Code Playgroud)