在html5视频标签中设置currentTime

时间:2017-07-03 21:34:07

标签: javascript vuejs2

简单地设置video.currentTime = 10不会在chrome中工作但是效果很好   在火狐中应该做些什么?   我刚刚创建了一个设置时间按钮的示例

    <template>
        <div>
    <video id="xx" controls height="300px" width="300px">
        <source src="videos/property.mp4" type="video/mp4" media="" >
    </video>                                                                     
         <button @click="changeIt">chnage</button>
         <button @click="playIt">play</button>
        </div>
    </template>
    <script>
     export default{
       mounted(){
          let y = document.getElementById("xx");
         y.controls=false;
               },
    methods:{
         changeIt(){
           let y = document.getElementById("xx");
           y.currentTime=15;
           console.log(video.currentTime);
                  },
         playIt(){
            let y = document.getElementById("xx");
            y.play();
            } 
         },

         }
        </script>

0 个答案:

没有答案