Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';使用jQuery在firefox中暂停视频_Jquery_Html5 Video_Mediaelement.js - Fatal编程技术网

Can';使用jQuery在firefox中暂停视频

Can';使用jQuery在firefox中暂停视频,jquery,html5-video,mediaelement.js,Jquery,Html5 Video,Mediaelement.js,HTML: 在chrome中,视频已正确暂停。但是在firefox中,它并没有暂停。有没有办法解决这个问题?试试这个: $('video').mediaelementplayer(); if($('video').attr('class') == "0"){ $('video')[0].player.pause(); } 试试这个: $('video').mediaelementplayer(); if($('video').attr('class') == "0"){ $

HTML:

在chrome中,视频已正确暂停。但是在firefox中,它并没有暂停。有没有办法解决这个问题?

试试这个:

$('video').mediaelementplayer();

if($('video').attr('class') == "0"){
    $('video')[0].player.pause();
}
试试这个:

$('video').mediaelementplayer();

if($('video').attr('class') == "0"){
    $('video')[0].player.pause();
}
试着这样做:

if($('video').attr('class') == "0"){
    $('video')[0].pause();
}

像这样尝试:

if($('video').attr('class') == "0"){
    $('video')[0].pause();
}


这将暂停您的视频

<video class='0' id='video_01'
  controls preload='none'  src="http://media.w3.org/2010/05/sintel/trailer.webm"
  poster="http://media.w3.org/2010/05/sintel/poster.png"   

  <p>Your user agent does not support the HTML5 Video element.</p>
</video>

function callPause(){  
    if($('video').attr('class') == "0"){
     $("video").get(0).pause();
     }
   return false;
   }
演示:


在侧注中,类不能以整数开头,这将暂停您的视频

<video class='0' id='video_01'
  controls preload='none'  src="http://media.w3.org/2010/05/sintel/trailer.webm"
  poster="http://media.w3.org/2010/05/sintel/poster.png"   

  <p>Your user agent does not support the HTML5 Video element.</p>
</video>

function callPause(){  
    if($('video').attr('class') == "0"){
     $("video").get(0).pause();
     }
   return false;
   }
演示:


旁注类不能以整数开始

@ArtWorkAD问题应该在其他地方,从MDN:
开始,停止媒体播放就像调用元素的pause()方法一样简单,浏览器会一直下载媒体,直到媒体元素通过垃圾收集处理。
@ArtWorkAD问题应该在其他地方,从MDN:
停止媒体播放就像调用元素的pause()方法一样简单,浏览器会一直下载媒体,直到通过垃圾收集处理完媒体元素。