Home  >  Article  >  Web Front-end  >  The attribute paused that returns whether the audio/video has been paused in html5

The attribute paused that returns whether the audio/video has been paused in html5

黄舟
黄舟Original
2017-11-09 09:54:373203browse

Example

Check if video is paused:

myVid=document.getElementById("video1");
alert(myVid.paused);

Definition and usage

paused attribute returns audio/video Has it been paused?

Browser support

All major browsers support the paused attribute.

Note: This attribute is not supported in Internet Explorer 8 or earlier browsers.

Syntax

audio|video.paused

Return value

Type Description
Boolean value true|false. true indicates that the audio/video is paused. Otherwise false.

Example

Check if the video is paused:

<!DOCTYPE html> 
<html> 
<body> 

<p>
	<button onclick="getNWState()" type="button">获得网络状态</button>
</p>
<video id="video1" controls="controls" autoplay="autoplay">
	<source src="/kf51/demo/mov_bbb.mp4" type="video/mp4">
	<source src="/kf51/demo/mov_bbb.ogg" type="video/ogg">
	您的浏览器不支持 video 标签。
</video>

<script>
var myVid = document.getElementById("video1");
function getNWState() { 
	alert(myVid.paused);
} 
</script> 

</body> 
</html>

The above is the detailed content of The attribute paused that returns whether the audio/video has been paused in html5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn