How to disable auto-play for local video in iframe

后端 未结 8 971
我在风中等你
我在风中等你 2020-12-29 21:08

How to disable auto-play for video when src is from my local pc?




        
相关标签:
8条回答
  • 2020-12-29 22:02

    Replace the iframe for this:

    <video class="video-fluid z-depth-1" loop controls muted>
      <source src="videos/example.mp4" type="video/mp4" />
    </video>
    
    0 讨论(0)
  • 2020-12-29 22:06

    You can set the source of the player as blank string on loading the page, in this way you don't have to switch to video tag.

    var player = document.getElementById("video-player");
    player.src = "";
    

    When you want to play a video, just change its src attribute, for example:

    function play(source){
       player.src = source;
    }
    
    0 讨论(0)
提交回复
热议问题