Horje
HTML onpause Event Attribute
Definition and Usage The onpause attribute defines a script to be run when the audio/video is paused either by the user or programmatically. Tip: The onplay attribute is used to define a script to run when the audio/video has been started or is no longer paused.

Example of HTML onpause Event Attribute

Play and pause the video.

index.html
Example: HTML
<!DOCTYPE html> <html> <body> <script>
function myFunction() { alert('The video has been paused');
}</script>
<p>
Play and pause the video.</p>
<video controls onpause="myFunction()"> <source src="https://download.samplelib.com/mp4/sample-5s.mp4" type="video/mp4"> <source src="https://download.samplelib.com/mp4/sample-5s.mp4" type="video/ogg"> Your browser does not support HTML5 video.</video>
<p>
Video courtesy of <a href="https://www.bigbuckbunny.org/" target="_blank">
Big Buck Bunny</a>
.</p>
</body> </html>

Output should be:

Example of HTML onpause Event Attribute

Definition and Usage of HTML onpause Event Attribute

The pause event occurs when the audio/video is paused either by the user or programmatically.

Tip: The play event occurs when the audio/video has been started or is no longer paused.

Browser Support of HTML onpause Event Attribute

The numbers in the table specify the first browser version that fully supports the event.

Output should be:

Browser Support of HTML onpause Event Attribute

Syntax of HTML onpause Event Attribute

< element onpause=" script ">

Attribute Values of HTML onpause Event Attribute

Value Description
script The script to be run on pause

Technical Details of HTML onpause Event Attribute

Supported HTML tags: <audio> and <video>

How to alert that the video has been paused

Play and pause the video.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>
<script>
function myFunction() { alert('The video has been paused');
}
</script>
<p>Play and pause the video.</p>
<video controls onpause="myFunction()"> <source src="https://download.samplelib.com/mp4/sample-5s.mp4" type="video/mp4"> <source src="https://download.samplelib.com/mp4/sample-5s.mp4" type="video/ogg"> Your browser does not support HTML5 video.
</video>
<p>Video courtesy of <a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>
</body>
</html>

Output should be:

How to alert that the video has been paused

How to alert that the audio has been paused

Play and pause the audio.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>
<script>
function myFunction() { alert('The audio has been paused');
}
</script>
<p>Play and pause the audio.</p>
<audio controls onpause="myFunction()"> <source src="https://file-examples.com/index.php/sample-audio-files/sample-mp3-download/" type="audio/ogg"> <source src="https://file-examples.com/index.php/sample-audio-files/sample-mp3-download/" type="audio/mpeg"> Your browser does not support the audio element.
</audio>
</body>
</html>

Output should be:

How to alert that the audio has been paused




html event attributes

Related Articles
List of Media Events HTML Media Events Attribute
HTML onabort Event Attrribute HTML Media Events Attribute
HTML oncanplay Event Attribute HTML Media Events Attribute
HTML oncanplaythrough Event Attribute HTML Media Events Attribute
HTML ondurationchange Event Attribute HTML Media Events Attribute
HTML onended Event Attribute HTML Media Events Attribute
HTML onerror Event Attribute HTML Media Events Attribute
HTML onloadeddata Event Attribute HTML Media Events Attribute
HTML onloadedmetadata Event Attribute HTML Media Events Attribute
HTML onloadstart Event Attribute HTML Media Events Attribute
HTML onpause Event Attribute HTML Media Events Attribute
HTML onplay Event Attribute HTML Media Events Attribute

Single Articles
Example of HTML onpause Event Attribute HTML Media Events Attribute
Definition and Usage of HTML onpause Event Attribute HTML Media Events Attribute
Browser Support of HTML onpause Event Attribute HTML Media Events Attribute
Syntax of HTML onpause Event Attribute HTML Media Events Attribute
Attribute Values of HTML onpause Event Attribute HTML Media Events Attribute
Technical Details of HTML onpause Event Attribute HTML Media Events Attribute
How to alert that the video has been paused HTML Media Events Attribute
How to alert that the audio has been paused HTML Media Events Attribute

Type :
Develop
Category :
Web Tutorial
Sub Category :
HTML Media Events Attribute
Uploaded by :
Admin


Read Article
https://horje.com/learn/1434/reference