Home > Web Front-end > H5 Tutorial > 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

黄舟
Release: 2017-11-09 09:54:37
Original
3259 people have browsed it

Example

Check if video is paused:

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

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
Copy after login

Return value

TypeDescription
Boolean valuetrue|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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template